summaryrefslogtreecommitdiff
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-01-19 16:21:02 +0300
committerChris Mason <clm@fb.com>2015-01-20 00:05:44 +0300
commit98bd5c547ef2300f915fc1adce5b6f25c195d4d4 (patch)
tree1c84d927fcfce33ff2688ba3a70c332dbbb2a68b /fs/btrfs/super.c
parent6f8960541b1eb6054a642da48daae2320fddba93 (diff)
downloadlinux-98bd5c547ef2300f915fc1adce5b6f25c195d4d4.tar.xz
btrfs: sync ioctl, handle errors after transaction start
The version merged to 3.19 did not handle errors from start_trancaction and could pass an invalid pointer to commit_transaction. Fixes: 6b5fe46dfa52441f ("btrfs: do commit in sync_fs if there are pending changes") Reported-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 60f7cbe815e9..c86fb5438454 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1001,9 +1001,9 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
if (fs_info->pending_changes == 0)
return 0;
trans = btrfs_start_transaction(root, 0);
- } else {
- return PTR_ERR(trans);
}
+ if (IS_ERR(trans))
+ return PTR_ERR(trans);
}
return btrfs_commit_transaction(trans, root);
}