]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: don't stop integrity writeback too early
authorChristoph Hellwig <hch@lst.de>
Mon, 24 Jul 2023 13:26:53 +0000 (06:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Aug 2023 16:21:02 +0000 (18:21 +0200)
commitbd3175f9d5977e2c2cffcf047a9c9813f35cd9e8
tree33af02d681008c7a64bf1478a77ce2d41432cce2
parentc91d822127d3557d99677505e4440974f5f88296
btrfs: don't stop integrity writeback too early

commit effa24f689ce0948f68c754991a445a8d697d3a8 upstream.

extent_write_cache_pages stops writing pages as soon as nr_to_write hits
zero.  That is the right thing for opportunistic writeback, but incorrect
for data integrity writeback, which needs to ensure that no dirty pages
are left in the range.  Thus only stop the writeback for WB_SYNC_NONE
if nr_to_write hits 0.

This is a port of write_cache_pages changes in commit 05fe478dd04e
("mm: write_cache_pages integrity fix").

Note that I've only trigger the problem with other changes to the btrfs
writeback code, but this condition seems worthwhile fixing anyway.

CC: stable@vger.kernel.org # 4.14+
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
[ updated comment ]
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent_io.c