btrfs_record_root_in_trans will return errors in the future, so handle
the error properly in btrfs_delete_subvolume.

Reviewed-by: Qu Wenruo <w...@suse.com>
Signed-off-by: Josef Bacik <jo...@toxicpanda.com>
---
 fs/btrfs/inode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c64a5e3eca47..48c953d0dde7 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4317,7 +4317,11 @@ int btrfs_delete_subvolume(struct inode *dir, struct 
dentry *dentry)
                goto out_end_trans;
        }
 
-       btrfs_record_root_in_trans(trans, dest);
+       ret = btrfs_record_root_in_trans(trans, dest);
+       if (ret) {
+               btrfs_abort_transaction(trans, ret);
+               goto out_end_trans;
+       }
 
        memset(&dest->root_item.drop_progress, 0,
                sizeof(dest->root_item.drop_progress));
-- 
2.26.2

Reply via email to