aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@gmail.com>2014-05-29 18:31:39 -0400
committerChris Mason <clm@fb.com>2014-06-09 20:21:06 -0400
commitb05fd8742f6291b67571ad0fdad4da6b6eb98025 (patch)
treec2fe9187c659db8c7c900b144c55a7810fcbf138 /fs/btrfs
parentd77815461f047e561f77a07754ae923ade597d4e (diff)
Btrfs: fix transaction leak during fsync call
If btrfs_log_dentry_safe() returns an error, we set ret to 1 and fall through with the goal of committing the transaction. However, in the case where the inode doesn't need a full sync, we would call btrfs_wait_ordered_range() against the target range for our inode, and if it returned an error, we would return without commiting or ending the transaction. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index eb3f2708a01d..ad7c05909a49 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2025,8 +2025,10 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
2025 if (!full_sync) { 2025 if (!full_sync) {
2026 ret = btrfs_wait_ordered_range(inode, start, 2026 ret = btrfs_wait_ordered_range(inode, start,
2027 end - start + 1); 2027 end - start + 1);
2028 if (ret) 2028 if (ret) {
2029 btrfs_end_transaction(trans, root);
2029 goto out; 2030 goto out;
2031 }
2030 } 2032 }
2031 ret = btrfs_commit_transaction(trans, root); 2033 ret = btrfs_commit_transaction(trans, root);
2032 } else { 2034 } else {