summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorRobbie Ko <robbieko@synology.com>2020-03-17 14:31:02 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-17 10:48:49 +0200
commited8703409b6faaa1222d58c73072d52182b1b04a (patch)
tree8e21121105b5c8d76f542287d7ff1f1ac1e511dc /fs
parent867ae5eb0ae869f94470e5edd6ebc278aa3f7a92 (diff)
downloadlinux-stable-ed8703409b6faaa1222d58c73072d52182b1b04a.tar.gz
linux-stable-ed8703409b6faaa1222d58c73072d52182b1b04a.tar.bz2
linux-stable-ed8703409b6faaa1222d58c73072d52182b1b04a.zip
btrfs: fix missing semaphore unlock in btrfs_sync_file
commit 6ff06729c22ec0b7498d900d79cc88cfb8aceaeb upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-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 1e3a6008e373..dc1841855a69 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2137,6 +2137,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;
}