]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Explicitly handle btrfs_update_root failure
authorNikolay Borisov <nborisov@suse.com>
Thu, 28 Sep 2017 07:53:17 +0000 (10:53 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 30 Oct 2017 11:27:58 +0000 (12:27 +0100)
commita9d1ce19f5a1e17906822de4ee5b36adea2cb9c0
treead38ec9df2f1766b55a31df3c552d931b5ec3518
parenta703a01f7b4a878f1af1a40094fe3faa127ca409
btrfs: Explicitly handle btrfs_update_root failure

btrfs_udpate_root can fail and it aborts the transaction, the correct
way to handle an aborted transaction is to explicitly end with
btrfs_end_transaction.  Even now the code is correct since
btrfs_commit_transaction would handle an aborted transaction but this is
more of an implementation detail. So let's be explicit in handling
failure in btrfs_update_root.

Furthermore btrfs_commit_transaction can also fail and by ignoring it's
return value we could have left the in-memory copy of the root item in
an inconsistent state. So capture the error value which allows us to
correctly revert the RO/RW flags in case of commit failure.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c