Commit 6ff06729 authored by Robbie Ko's avatar Robbie Ko Committed by David Sterba

btrfs: fix missing semaphore unlock in btrfs_sync_file

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: aab15e8e ("Btrfs: fix rare chances for data loss when doing a fast fsync")
CC: stable@vger.kernel.org # 4.19+
Signed-off-by: default avatarRobbie Ko <robbieko@synology.com>
Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
[ add changelog ]
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 351cbf6e
...@@ -2117,6 +2117,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -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); ret = start_ordered_ops(inode, start, end);
if (ret) { if (ret) {
up_write(&BTRFS_I(inode)->dio_sem);
inode_unlock(inode); inode_unlock(inode);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment