Btrfs: Fix async caching interaction with unmount
- don't stop the caching thread until btrfs_commit_super return.
- if caching is interrupted by umount, set last to (u64)-1.
otherwise the un-scanned range of block group will be considered
as free extent.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 08188f1..fadf69a 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -288,8 +288,10 @@
while (1) {
smp_mb();
- if (block_group->fs_info->closing)
+ if (block_group->fs_info->closing > 1) {
+ last = (u64)-1;
break;
+ }
leaf = path->nodes[0];
slot = path->slots[0];