projects/linux·commit 6ff06729

btrfs: fix missing semaphore unlock in btrfs_sync_file

6ff06729 · Robbie Ko <[email protected]> · 2020-03-17 14:31:02 +08:00

Ordered ops are started twice in sync file, once outside of inode mutex
and once inside, taking the dio semaphore. There was one error path
missing the semaphore unlock.

Fixes: aab15e8ec2576 ("Btrfs: fix rare chances for data loss when doing a fast fsync")
CC: [email protected] # 4.19+
Signed-off-by: Robbie Ko <[email protected]>
Reviewed-by: Filipe Manana <[email protected]>
[ add changelog ]
Signed-off-by: David Sterba <[email protected]>
Commit
6ff06729c22ec0b7498d900d79cc88cfb8aceaeb
Parents
351cbf6e

Changes

1 files changed · +1 −0

FileStatusAddDelContent
fs/btrfs/file.cmodified+1−0View file

fs/btrfs/file.c

View file
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 20107f4..8a144f9 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2117,6 +2117,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
*/
ret = start_ordered_ops(inode, start, end);
if (ret) {
+ up_write(&BTRFS_I(inode)->dio_sem);
inode_unlock(inode);
goto out;
}