]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: zoned: fix parallel compressed writes
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Tue, 18 May 2021 15:40:28 +0000 (00:40 +0900)
committerDavid Sterba <dsterba@suse.com>
Thu, 20 May 2021 13:51:07 +0000 (15:51 +0200)
commitcc6a2c04396e450622b7efc220a1c499a85db4ee
tree40fb1fea29573fe90c6473331d4285d275f36c14
parent4def0aee366b5329b25c1b510d3853e177f99ada
btrfs: zoned: fix parallel compressed writes

When multiple processes write data to the same block group on a
compressed zoned filesystem, the underlying device could report I/O
errors and data corruption is possible.

This happens because on a zoned file system, compressed data writes
where sent to the device via a REQ_OP_WRITE instead of a
REQ_OP_ZONE_APPEND operation. But with REQ_OP_WRITE and parallel
submission it cannot be guaranteed that the data is always submitted
aligned to the underlying zone's write pointer.

The change to using REQ_OP_ZONE_APPEND instead of REQ_OP_WRITE on a
zoned filesystem is non intrusive on a regular file system or when
submitting to a conventional zone on a zoned filesystem, as it is
guarded by btrfs_use_zone_append.

Reported-by: David Sterba <dsterba@suse.com>
Fixes: f51151684715 ("btrfs: zoned: enable to mount ZONED incompat flag")
CC: stable@vger.kernel.org # 5.12.x: 4def0aee366b53: btrfs: zoned: pass start block to btrfs_use_zone_append
CC: stable@vger.kernel.org # 5.12.x
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c