Skip to content

Commit 6ff0672

Browse files
Robbie Kokdave
authored andcommitted
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: aab15e8 ("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]>
1 parent 351cbf6 commit 6ff0672

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
21172117
*/
21182118
ret = start_ordered_ops(inode, start, end);
21192119
if (ret) {
2120+
up_write(&BTRFS_I(inode)->dio_sem);
21202121
inode_unlock(inode);
21212122
goto out;
21222123
}

0 commit comments

Comments
 (0)