From: Josef Bacik Date: Wed, 24 Apr 2013 20:40:05 +0000 (-0400) Subject: Btrfs: check return value of commit when recovering log X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=abefa55ac1f8cb8fb8cb4d7e8d619dc0859181ab;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git Btrfs: check return value of commit when recovering log We need to check the return value of the commit in case something goes wrong, otherwise we could end up going down the line and doing more stuff (like orphan cleanup) before we notice we should have errored out. We need to do this before we free up the log_tree_root since the caller will handle all of that. Thanks, Signed-off-by: Josef Bacik --- diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 1fdc221a9c0..f50137a98fb 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -4012,16 +4012,17 @@ again: btrfs_free_path(path); + /* step 4: commit the transaction, which also unpins the blocks */ + ret = btrfs_commit_transaction(trans, fs_info->tree_root); + if (ret) + return ret; + free_extent_buffer(log_root_tree->node); log_root_tree->log_root = NULL; fs_info->log_root_recovering = 0; - - /* step 4: commit the transaction, which also unpins the blocks */ - btrfs_commit_transaction(trans, fs_info->tree_root); - kfree(log_root_tree); - return 0; + return 0; error: btrfs_free_path(path); return ret;