]> git.itanic.dy.fi Git - linux-stable/commit
btrfs: zero the buffer before marking it dirty in btrfs_redirty_list_add
authorChristoph Hellwig <hch@lst.de>
Mon, 8 May 2023 14:58:37 +0000 (07:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:50:22 +0000 (11:50 +0200)
commitbcc401bb8678a1ef4c9561f5e4a30067133be470
treefdf3aed9b1a595a8f31968dd761b1066997b71f1
parentf264be24146bee2d652010a18ae2517df5856261
btrfs: zero the buffer before marking it dirty in btrfs_redirty_list_add

commit c83b56d1dd87cf67492bb770c26d6f87aee70ed6 upstream.

btrfs_redirty_list_add zeroes the buffer data and sets the
EXTENT_BUFFER_NO_CHECK to make sure writeback is fine with a bogus
header.  But it does that after already marking the buffer dirty, which
means that writeback could already be looking at the buffer.

Switch the order of operations around so that the buffer is only marked
dirty when we're ready to write it.

Fixes: d3575156f662 ("btrfs: zoned: redirty released extent buffers")
CC: stable@vger.kernel.org # 5.15+
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/zoned.c