Skip to content

Commit

Permalink
btrfs: sync ioctl, handle errors after transaction start
Browse files Browse the repository at this point in the history
The version merged to 3.19 did not handle errors from start_trancaction
and could pass an invalid pointer to commit_transaction.

Fixes: 6b5fe46 ("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>
  • Loading branch information
David Sterba authored and Chris Mason committed Jan 19, 2015
1 parent 6f89605 commit 98bd5c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/btrfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 98bd5c5

Please sign in to comment.