]> git.hungrycats.org Git - linux/commitdiff
Btrfs: don't do async reclaim during log replay
authorJosef Bacik <jbacik@fb.com>
Thu, 18 Sep 2014 15:27:17 +0000 (11:27 -0400)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Tue, 21 Oct 2014 03:13:49 +0000 (23:13 -0400)
Trying to reproduce a log enospc bug I hit a panic in the async reclaim code
during log replay.  This is because we use fs_info->fs_root as our root for
shrinking and such.  Technically we can use whatever root we want, but let's
just not allow async reclaim while we're doing log replay.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit f6acfd50110b335c7af636cf1fc8e55319cae5fc)

fs/btrfs/extent-tree.c

index 3efe1c3877bf34c4643ce99fb90d52fedda74d06..98042c1a48b4cb5b25f02dc8adb7c8d9bf5e5fab 100644 (file)
@@ -4502,7 +4502,13 @@ again:
                space_info->flush = 1;
        } else if (!ret && space_info->flags & BTRFS_BLOCK_GROUP_METADATA) {
                used += orig_bytes;
-               if (need_do_async_reclaim(space_info, root->fs_info, used) &&
+               /*
+                * We will do the space reservation dance during log replay,
+                * which means we won't have fs_info->fs_root set, so don't do
+                * the async reclaim as we will panic.
+                */
+               if (!root->fs_info->log_root_recovering &&
+                   need_do_async_reclaim(space_info, root->fs_info, used) &&
                    !work_busy(&root->fs_info->async_reclaim_work))
                        queue_work(system_unbound_wq,
                                   &root->fs_info->async_reclaim_work);