record_root_in_trans can fail currently, so handle this failure
properly.

Reviewed-by: Qu Wenruo <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
---
 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 307a73abe86d..5b3008ec4e13 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1436,7 +1436,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;
 
        /*
         * We are going to commit transaction, see btrfs_commit_transaction()
@@ -1488,7 +1490,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