* [PATCH] btrfs: fix re-dirty process of tree-log nodes
@ 2021-11-29 2:49 Naohiro Aota
2021-11-29 7:57 ` Johannes Thumshirn
2021-11-29 12:19 ` David Sterba
0 siblings, 2 replies; 5+ messages in thread
From: Naohiro Aota @ 2021-11-29 2:49 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba, Naohiro Aota
For zoned btrfs, we re-dirty a freeing tree node to ensure btrfs write
the region and not to leave a write hole on a zoned device. Current
code failed to re-dirty a node when the tree-log tree's depth >=
2. This leads to a transaction abort with -EAGAIN.
Fix the issue by properly re-dirty a node on walking up the tree.
Link: https://github.com/kdave/btrfs-progs/issues/415
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
fs/btrfs/tree-log.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index de79e15a7c6a..a42e132f35f5 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2890,6 +2890,8 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
path->nodes[*level]->len);
if (ret)
return ret;
+ btrfs_redirty_list_add(trans->transaction,
+ next);
} else {
if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags))
clear_extent_buffer_dirty(next);
@@ -2970,6 +2972,8 @@ static int walk_log_tree(struct btrfs_trans_handle *trans,
next->start, next->len);
if (ret)
goto out;
+ btrfs_redirty_list_add(trans->transaction,
+ next);
} else {
if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags))
clear_extent_buffer_dirty(next);
@@ -3420,8 +3424,6 @@ static void free_log_tree(struct btrfs_trans_handle *trans,
EXTENT_DIRTY | EXTENT_NEW | EXTENT_NEED_WAIT);
extent_io_tree_release(&log->log_csum_range);
- if (trans && log->node)
- btrfs_redirty_list_add(trans->transaction, log->node);
btrfs_put_root(log);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: fix re-dirty process of tree-log nodes
2021-11-29 2:49 [PATCH] btrfs: fix re-dirty process of tree-log nodes Naohiro Aota
@ 2021-11-29 7:57 ` Johannes Thumshirn
2021-11-30 1:51 ` Naohiro Aota
2021-11-29 12:19 ` David Sterba
1 sibling, 1 reply; 5+ messages in thread
From: Johannes Thumshirn @ 2021-11-29 7:57 UTC (permalink / raw)
To: Naohiro Aota, linux-btrfs; +Cc: David Sterba
On 29/11/2021 03:51, Naohiro Aota wrote:
> For zoned btrfs, we re-dirty a freeing tree node to ensure btrfs write
> the region and not to leave a write hole on a zoned device. Current
> code failed to re-dirty a node when the tree-log tree's depth >=
> 2. This leads to a transaction abort with -EAGAIN.
>
I'd rephrase the above to:
For zoned btrfs, we re-dirty a freed tree node to ensure btrfs
can write the region and does not leave a hole on write on a zoned
device. The current code fails to failed to re-dirty a node when the
tree-log tree's depth was greater or equal to 2. This lead to a
transaction abort with -EAGAIN.
> Fix the issue by properly re-dirty a node on walking up the tree.
>
> Link: https://github.com/kdave/btrfs-progs/issues/415
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Shouldn't we mark this for stable (v5.15)? After all the reporter did
hit the problem on 5.15.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: fix re-dirty process of tree-log nodes
2021-11-29 2:49 [PATCH] btrfs: fix re-dirty process of tree-log nodes Naohiro Aota
2021-11-29 7:57 ` Johannes Thumshirn
@ 2021-11-29 12:19 ` David Sterba
2021-11-30 1:51 ` Naohiro Aota
1 sibling, 1 reply; 5+ messages in thread
From: David Sterba @ 2021-11-29 12:19 UTC (permalink / raw)
To: Naohiro Aota; +Cc: linux-btrfs, David Sterba
On Mon, Nov 29, 2021 at 11:49:30AM +0900, Naohiro Aota wrote:
> For zoned btrfs, we re-dirty a freeing tree node to ensure btrfs write
> the region and not to leave a write hole on a zoned device. Current
> code failed to re-dirty a node when the tree-log tree's depth >=
> 2. This leads to a transaction abort with -EAGAIN.
>
> Fix the issue by properly re-dirty a node on walking up the tree.
>
> Link: https://github.com/kdave/btrfs-progs/issues/415
Can you please add more information from the issue that's relevant to
the problem? Eg. the stacktraces, reproducer etc.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: fix re-dirty process of tree-log nodes
2021-11-29 7:57 ` Johannes Thumshirn
@ 2021-11-30 1:51 ` Naohiro Aota
0 siblings, 0 replies; 5+ messages in thread
From: Naohiro Aota @ 2021-11-30 1:51 UTC (permalink / raw)
To: Johannes Thumshirn; +Cc: linux-btrfs, David Sterba
On Mon, Nov 29, 2021 at 07:57:39AM +0000, Johannes Thumshirn wrote:
> On 29/11/2021 03:51, Naohiro Aota wrote:
> > For zoned btrfs, we re-dirty a freeing tree node to ensure btrfs write
> > the region and not to leave a write hole on a zoned device. Current
> > code failed to re-dirty a node when the tree-log tree's depth >=
> > 2. This leads to a transaction abort with -EAGAIN.
> >
>
> I'd rephrase the above to:
>
> For zoned btrfs, we re-dirty a freed tree node to ensure btrfs
> can write the region and does not leave a hole on write on a zoned
> device. The current code fails to failed to re-dirty a node when the
> tree-log tree's depth was greater or equal to 2. This lead to a
> transaction abort with -EAGAIN.
>
>
> > Fix the issue by properly re-dirty a node on walking up the tree.
> >
> > Link: https://github.com/kdave/btrfs-progs/issues/415
> > Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> > ---
>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>
> Shouldn't we mark this for stable (v5.15)? After all the reporter did
> hit the problem on 5.15.
>
Oops, I've added the fixes tag and the stable tag to the commit, but
somehow I forgot to update the patch file. I'll resend the patch with
your fix with for the commit log. Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: fix re-dirty process of tree-log nodes
2021-11-29 12:19 ` David Sterba
@ 2021-11-30 1:51 ` Naohiro Aota
0 siblings, 0 replies; 5+ messages in thread
From: Naohiro Aota @ 2021-11-30 1:51 UTC (permalink / raw)
To: dsterba, linux-btrfs, David Sterba
On Mon, Nov 29, 2021 at 01:19:39PM +0100, David Sterba wrote:
> On Mon, Nov 29, 2021 at 11:49:30AM +0900, Naohiro Aota wrote:
> > For zoned btrfs, we re-dirty a freeing tree node to ensure btrfs write
> > the region and not to leave a write hole on a zoned device. Current
> > code failed to re-dirty a node when the tree-log tree's depth >=
> > 2. This leads to a transaction abort with -EAGAIN.
> >
> > Fix the issue by properly re-dirty a node on walking up the tree.
> >
> > Link: https://github.com/kdave/btrfs-progs/issues/415
>
> Can you please add more information from the issue that's relevant to
> the problem? Eg. the stacktraces, reproducer etc.
Sure. I'll revise the patch with the fixes tags.
Thanks,
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-11-30 1:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 2:49 [PATCH] btrfs: fix re-dirty process of tree-log nodes Naohiro Aota
2021-11-29 7:57 ` Johannes Thumshirn
2021-11-30 1:51 ` Naohiro Aota
2021-11-29 12:19 ` David Sterba
2021-11-30 1:51 ` Naohiro Aota
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.