Skip to content

Commit

Permalink
btrfs: Fix no_space in write and rm loop
Browse files Browse the repository at this point in the history
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 bdced43 ("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>
  • Loading branch information
Zhao Lei authored and Chris Mason committed Jan 20, 2016
1 parent 0bc19f9 commit e1746e8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4139,8 +4139,10 @@ int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes)
!atomic_read(&root->fs_info->open_ioctl_trans)) {
need_commit--;

if (need_commit > 0)
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))
Expand Down

0 comments on commit e1746e8

Please sign in to comment.