* [PATCH] btrfs: wait for delayed iputs on no space
@ 2015-03-27 10:21 Zhaolei
2015-03-27 10:21 ` Zhaolei
2015-03-31 8:26 ` Tsutomu Itoh
0 siblings, 2 replies; 3+ messages in thread
From: Zhaolei @ 2015-03-27 10:21 UTC (permalink / raw)
To: linux-btrfs; +Cc: Zhao Lei
From: Zhao Lei <zhaolei@cn.fujitsu.com>
This is another fix of no_space case.
All patchs for fix no_space bug are available at fix_no_space
branch on:
git://github.com/zhaoleidd/btrfs
Any suggestions are welcome.
Zhao Lei (1):
btrfs: wait for delayed iputs on no space
fs/btrfs/extent-tree.c | 3 +++
1 file changed, 3 insertions(+)
--
1.8.5.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] btrfs: wait for delayed iputs on no space
2015-03-27 10:21 [PATCH] btrfs: wait for delayed iputs on no space Zhaolei
@ 2015-03-27 10:21 ` Zhaolei
2015-03-31 8:26 ` Tsutomu Itoh
1 sibling, 0 replies; 3+ messages in thread
From: Zhaolei @ 2015-03-27 10:21 UTC (permalink / raw)
To: linux-btrfs; +Cc: Zhao Lei
From: Zhao Lei <zhaolei@cn.fujitsu.com>
btrfs will report no_space when we run following write and delete
file loop:
# FILE_SIZE_M=[ 75% of fs space ]
# DEV=[ some dev ]
# MNT=[ some dir ]
#
# mkfs.btrfs -f "$DEV"
# mount -o nodatacow "$DEV" "$MNT"
# for ((i = 0; i < 100; i++)); do dd if=/dev/zero of="$MNT"/file0 bs=1M count="$FILE_SIZE_M"; rm -f "$MNT"/file0; done
#
Reason:
iput() and evict() is run after write pages to block device, if
write pages work is not finished before next write, the "rm"ed space
is not freed, and caused above bug.
Fix:
We can add "-o flushoncommit" mount option to avoid above bug, but
it have performance problem. Actually, we can to wait for on-the-fly
writes only when no-space happened, it is which this patch do.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
fs/btrfs/extent-tree.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 6c1e211..94fb15f 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3683,6 +3683,9 @@ commit_trans:
!atomic_read(&root->fs_info->open_ioctl_trans)) {
need_commit--;
+ if (need_commit > 0)
+ btrfs_wait_ordered_roots(fs_info, -1);
+
trans = btrfs_join_transaction(root);
if (IS_ERR(trans))
return PTR_ERR(trans);
--
1.8.5.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: wait for delayed iputs on no space
2015-03-27 10:21 [PATCH] btrfs: wait for delayed iputs on no space Zhaolei
2015-03-27 10:21 ` Zhaolei
@ 2015-03-31 8:26 ` Tsutomu Itoh
1 sibling, 0 replies; 3+ messages in thread
From: Tsutomu Itoh @ 2015-03-31 8:26 UTC (permalink / raw)
To: Zhaolei, linux-btrfs
On 2015/03/27 19:21, Zhaolei wrote:
> From: Zhao Lei <zhaolei@cn.fujitsu.com>
>
> This is another fix of no_space case.
>
> All patchs for fix no_space bug are available at fix_no_space
> branch on:
> git://github.com/zhaoleidd/btrfs
I tested in the environment that applied the following patch to
'fix_no_space' branch.
- Btrfs: fix find_free_dev_extent() malfunction in case device tree has hole
It works fine to me. Thanks.
Tested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
>
> Any suggestions are welcome.
>
> Zhao Lei (1):
> btrfs: wait for delayed iputs on no space
>
> fs/btrfs/extent-tree.c | 3 +++
> 1 file changed, 3 insertions(+)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-31 8:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-27 10:21 [PATCH] btrfs: wait for delayed iputs on no space Zhaolei
2015-03-27 10:21 ` Zhaolei
2015-03-31 8:26 ` Tsutomu Itoh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).