diff options
author | Yan Zheng <zheng.yan@oracle.com> | 2009-07-28 08:41:57 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-07-28 08:41:57 -0400 |
commit | f25784b35f590c81d5fb8245a8cd45e1afb6f1b2 (patch) | |
tree | 71306747041b6e4a5eaccc5028c770fed29b3f87 /fs | |
parent | 68b38550ddbea13d296184bf69edff387618b1d3 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/disk-io.c | 3 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index c658397c7473..3a9b88759880 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2317,6 +2317,9 @@ int close_ctree(struct btrfs_root *root) | |||
2317 | printk(KERN_ERR "btrfs: commit super ret %d\n", ret); | 2317 | printk(KERN_ERR "btrfs: commit super ret %d\n", ret); |
2318 | } | 2318 | } |
2319 | 2319 | ||
2320 | fs_info->closing = 2; | ||
2321 | smp_mb(); | ||
2322 | |||
2320 | if (fs_info->delalloc_bytes) { | 2323 | if (fs_info->delalloc_bytes) { |
2321 | printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n", | 2324 | printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n", |
2322 | (unsigned long long)fs_info->delalloc_bytes); | 2325 | (unsigned long long)fs_info->delalloc_bytes); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 08188f1615d9..fadf69a2764b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -288,8 +288,10 @@ again: | |||
288 | 288 | ||
289 | while (1) { | 289 | while (1) { |
290 | smp_mb(); | 290 | smp_mb(); |
291 | if (block_group->fs_info->closing) | 291 | if (block_group->fs_info->closing > 1) { |
292 | last = (u64)-1; | ||
292 | break; | 293 | break; |
294 | } | ||
293 | 295 | ||
294 | leaf = path->nodes[0]; | 296 | leaf = path->nodes[0]; |
295 | slot = path->slots[0]; | 297 | slot = path->slots[0]; |