aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs
diff options
context:
space:
mode:
authorGravatar Robbie Ko <robbieko@synology.com> 2020-03-17 14:31:02 +0800
committerGravatar David Sterba <dsterba@suse.com> 2020-03-25 16:29:16 +0100
commit6ff06729c22ec0b7498d900d79cc88cfb8aceaeb (patch)
tree90d285bcd137735cd26ca942412fdc47065df5b0 /fs/btrfs
parentbtrfs: use nofs allocations for running delayed items (diff)
downloadlinux-6ff06729c22ec0b7498d900d79cc88cfb8aceaeb.tar.gz
linux-6ff06729c22ec0b7498d900d79cc88cfb8aceaeb.tar.bz2
linux-6ff06729c22ec0b7498d900d79cc88cfb8aceaeb.zip
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: aab15e8ec2576 ("Btrfs: fix rare chances for data loss when doing a fast fsync") CC: stable@vger.kernel.org # 4.19+ Signed-off-by: Robbie Ko <robbieko@synology.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> [ add changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/file.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 20107f42a766..8a144f9cb7ac 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;
}