]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: do proper error handling in create_reloc_inode
authorJosef Bacik <josef@toxicpanda.com>
Fri, 12 Mar 2021 20:25:28 +0000 (15:25 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Apr 2021 15:25:21 +0000 (17:25 +0200)
commit326e8ec1efd9c80d151c230e79e429a045616ea5
treef1e2d88522a43b4f5969efdf2e35920d2827db49
parent9f432488b5ab483d45be8ccb095c5a8482618774
btrfs: do proper error handling in create_reloc_inode

We already handle some errors in this function, and the callers do the
correct error handling, so clean up the rest of the function to do the
appropriate error handling.

There's a little extra work that needs to be done here, as we create the
inode item before we create the orphan item.  We could potentially add
the orphan item, but if we failed to create the inode item we would have
to abort the transaction.

Instead add a helper to delete the inode item we created in the case
that we're unable to look up the inode (this would likely be caused by
an ENOMEM), which if it succeeds means we can avoid a transaction abort
in this particular error case.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c