[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_8F5362E361A97883B8444B1763F777C6DF05@qq.com>
Date: Fri, 2 Aug 2024 19:54:27 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+7dbbb74af6291b5a5a8b@...kaller.appspotmail.com
Cc: clm@...com,
dsterba@...e.com,
fdmanana@...e.com,
hreitz@...hat.com,
josef@...icpanda.com,
linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: [PATCH] btrfs: Add missing skip-lock for locks
The commit 939b656bc8ab missing a skip-lock in btrfs_sync_file,
it cause syzbot report WARNING: bad unlock balance in btrfs_direct_write.
Fixes: 939b656bc8ab ("btrfs: fix corruption after buffer fault in during direct IO append write")
Reported-and-tested-by: syzbot+7dbbb74af6291b5a5a8b@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=7dbbb74af6291b5a5a8b
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
fs/btrfs/file.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 9f10a9f23fcc..9914419f3b7d 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1868,7 +1868,10 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
out_release_extents:
btrfs_release_log_ctx_extents(&ctx);
- btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);
+ if (skip_ilock)
+ up_write(&inode->i_mmap_lock);
+ else
+ btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);
goto out;
}
--
2.43.0
Powered by blists - more mailing lists