btrfs: check return value of btrfs_commit_transaction in relocation
[sfrench/cifs-2.6.git] / fs / btrfs / relocation.c
index fb5125c8308cf0e9205ff053c0c9ca2f875f8a29..b70be2ac2e9e61a37865f058f9a368752fe4337c 100644 (file)
@@ -1924,7 +1924,7 @@ again:
        list_splice(&reloc_roots, &rc->reloc_roots);
 
        if (!err)
-               btrfs_commit_transaction(trans);
+               err = btrfs_commit_transaction(trans);
        else
                btrfs_end_transaction(trans);
        return err;
@@ -3496,8 +3496,7 @@ int prepare_to_relocate(struct reloc_control *rc)
                 */
                return PTR_ERR(trans);
        }
-       btrfs_commit_transaction(trans);
-       return 0;
+       return btrfs_commit_transaction(trans);
 }
 
 static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
@@ -3656,7 +3655,9 @@ restart:
                err = PTR_ERR(trans);
                goto out_free;
        }
-       btrfs_commit_transaction(trans);
+       ret = btrfs_commit_transaction(trans);
+       if (ret && !err)
+               err = ret;
 out_free:
        ret = clean_dirty_subvols(rc);
        if (ret < 0 && !err)