]> git.hungrycats.org Git - linux/commitdiff
btrfs: Fix no_space in write and rm loop
authorZhao Lei <zhaolei@cn.fujitsu.com>
Tue, 1 Dec 2015 10:39:40 +0000 (18:39 +0800)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Sun, 24 Jan 2016 04:34:18 +0000 (23:34 -0500)
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>
(cherry picked from commit e1746e8381cd2af421f75557b5cae3604fc18b35)

Conflicts:
fs/btrfs/extent-tree.c

fs/btrfs/extent-tree.c

index 7bae61abba04e8fbc0ce2097962c6ba4926ab1aa..e6179dd867f9055744e97c13a96ef4cc76eaff9d 100644 (file)
@@ -4112,6 +4112,11 @@ commit_trans:
                    !atomic_read(&root->fs_info->open_ioctl_trans)) {
                        need_commit--;
 
+                       if (need_commit > 0) {
+                               btrfs_start_delalloc_roots(fs_info, 0, -1);
+                               btrfs_wait_ordered_roots(fs_info, -1);
+                       }
+
                        trans = btrfs_join_transaction(root);
                        if (IS_ERR(trans))
                                return PTR_ERR(trans);