Skip to content

Commit

Permalink
Btrfs: Fix async caching interaction with unmount
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
Yan Zheng authored and Chris Mason committed Jul 28, 2009
1 parent 68b3855 commit f25784b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2317,6 +2317,9 @@ int close_ctree(struct btrfs_root *root)
printk(KERN_ERR "btrfs: commit super ret %d\n", ret);
}

fs_info->closing = 2;
smp_mb();

if (fs_info->delalloc_bytes) {
printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n",
(unsigned long long)fs_info->delalloc_bytes);
Expand Down
4 changes: 3 additions & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,10 @@ static int caching_kthread(void *data)

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];
Expand Down

0 comments on commit f25784b

Please sign in to comment.