diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2015-12-01 05:39:40 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2016-01-20 10:22:14 -0500 |
commit | e1746e8381cd2af421f75557b5cae3604fc18b35 (patch) | |
tree | fb140445ed587ff5c0bbdbea6e06fa659b106c92 | |
parent | 0bc19f9031e0c59770286f82b8561c1d35064a65 (diff) |
btrfs: Fix no_space in write and rm loop
I see no_space in v4.4-rc1 again in xfstests generic/102.
It happened randomly in some node only.
(one of 4 phy-node, and a kvm with non-virtio block driver)
By bisect, we can found the first-bad is:
commit bdced438acd8 ("block: setup bi_phys_segments after splitting")'
But above patch only triggered the bug by making bio operation
faster(or slower).
Main reason is in our space_allocating code, we need to commit
page writeback before wait it complish, this patch fixed above
bug.
BTW, there is another reason for generic/102 fail, caused by
disable default mixed-blockgroup, I'll fix it in xfstests.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r-- | fs/btrfs/extent-tree.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 8e8079808728..e2287c7c10be 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -4139,8 +4139,10 @@ commit_trans: | |||
4139 | !atomic_read(&root->fs_info->open_ioctl_trans)) { | 4139 | !atomic_read(&root->fs_info->open_ioctl_trans)) { |
4140 | need_commit--; | 4140 | need_commit--; |
4141 | 4141 | ||
4142 | if (need_commit > 0) | 4142 | if (need_commit > 0) { |
4143 | btrfs_start_delalloc_roots(fs_info, 0, -1); | ||
4143 | btrfs_wait_ordered_roots(fs_info, -1); | 4144 | btrfs_wait_ordered_roots(fs_info, -1); |
4145 | } | ||
4144 | 4146 | ||
4145 | trans = btrfs_join_transaction(root); | 4147 | trans = btrfs_join_transaction(root); |
4146 | if (IS_ERR(trans)) | 4148 | if (IS_ERR(trans)) |