]> 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)
committerDavid Sterba <dsterba@suse.com>
Tue, 21 Jun 2022 12:46:30 +0000 (14:46 +0200)
commit88e34c130b7d978282924c4fd1a16a815b355fc0
tree533944319310feff0c84f82b14de79ae654165c8
parent5a0e19a14d4265c74d9f88431e77abb23ca0a5f5
btrfs: zoned: fix critical section of relocation inode writeback

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>
fs/btrfs/extent_io.c