record_root_in_trans can fail currently, so handle this failure
properly.

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

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 3a3a582063b4..26c91c4eba89 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1444,7 +1444,9 @@ static int qgroup_account_snapshot(struct 
btrfs_trans_handle *trans,
         * recorded root will never be updated again, causing an outdated root
         * item.
         */
-       record_root_in_trans(trans, src, 1);
+       ret = record_root_in_trans(trans, src, 1);
+       if (ret)
+               return ret;
 
        /*
         * btrfs_qgroup_inherit relies on a consistent view of the usage for the
@@ -1513,7 +1515,7 @@ static int qgroup_account_snapshot(struct 
btrfs_trans_handle *trans,
         * insert_dir_item()
         */
        if (!ret)
-               record_root_in_trans(trans, parent, 1);
+               ret = record_root_in_trans(trans, parent, 1);
        return ret;
 }
 
-- 
2.26.2

Reply via email to