提交 f25784b3 编写于 作者: Y Yan Zheng 提交者: Chris Mason

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: NChris Mason <chris.mason@oracle.com>
上级 68b38550
...@@ -2317,6 +2317,9 @@ int close_ctree(struct btrfs_root *root) ...@@ -2317,6 +2317,9 @@ int close_ctree(struct btrfs_root *root)
printk(KERN_ERR "btrfs: commit super ret %d\n", ret); printk(KERN_ERR "btrfs: commit super ret %d\n", ret);
} }
fs_info->closing = 2;
smp_mb();
if (fs_info->delalloc_bytes) { if (fs_info->delalloc_bytes) {
printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n", printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n",
(unsigned long long)fs_info->delalloc_bytes); (unsigned long long)fs_info->delalloc_bytes);
......
...@@ -288,8 +288,10 @@ static int caching_kthread(void *data) ...@@ -288,8 +288,10 @@ static int caching_kthread(void *data)
while (1) { while (1) {
smp_mb(); smp_mb();
if (block_group->fs_info->closing) if (block_group->fs_info->closing > 1) {
last = (u64)-1;
break; break;
}
leaf = path->nodes[0]; leaf = path->nodes[0];
slot = path->slots[0]; slot = path->slots[0];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册