]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: zoned: fix critical section of relocation inode writeback
authorNaohiro Aota <naohiro.aota@wdc.com>
Tue, 7 Jun 2022 07:08:30 +0000 (16:08 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Aug 2022 11:07:52 +0000 (13:07 +0200)
commit28216965a5d57ba2776b5d23c7e8d6b8ad029ca6
tree632e59a6baf3dd9a4b2fc662c69a441ef8672a63
parent0d40596f0bf1c0c5ea1f1cf0b2b4d488dd2b75eb
btrfs: zoned: fix critical section of relocation inode writeback

commit 88e34c130b7d978282924c4fd1a16a815b355fc0 upstream.

We use btrfs_zoned_data_reloc_{lock,unlock} to allow only one process to
write out to the relocation inode. That critical section must include all
the IO submission for the inode. However, flush_write_bio() in
extent_writepages() is out of the critical section, causing an IO
submission outside of the lock. This leads to an out of the order IO
submission and fail the relocation process.

Fix it by extending the critical section.

Fixes: 5ec7c05c9358 ("btrfs: zoned: only allow one process to add pages to a relocation inode")
CC: stable@vger.kernel.org # 5.16+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent_io.c