btrfs: release metadata before running delayed refs
authorJosef Bacik <josef@toxicpanda.com>
Fri, 28 Sep 2018 11:17:48 +0000 (07:17 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 15 Oct 2018 15:23:38 +0000 (17:23 +0200)
We want to release the unused reservation we have since it refills the
delayed refs reserve, which will make everything go smoother when
running the delayed refs if we're short on our reservation.

CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/transaction.c

index cadc747292d9f4b833c8d332a1be16b8256bef9c..e7f618b17b076a3c5e9eeb84d14b069a2ee91dcb 100644 (file)
@@ -1932,6 +1932,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
                return ret;
        }
 
+       btrfs_trans_release_metadata(trans);
+       trans->block_rsv = NULL;
+
        /* make a pass through all the delayed refs we have so far
         * any runnings procs may add more while we are here
         */
@@ -1941,9 +1944,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
                return ret;
        }
 
-       btrfs_trans_release_metadata(trans);
-       trans->block_rsv = NULL;
-
        cur_trans = trans->transaction;
 
        /*