Re: [PATCH 5.12 038/127] btrfs: zoned: fix parallel compressed writes

From: David Sterba
Date: Tue May 25 2021 - 08:03:35 EST


On Mon, May 24, 2021 at 05:25:55PM +0200, Greg Kroah-Hartman wrote:
> From: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
>
> commit 764c7c9a464b68f7c6a5a9ec0b923176a05e8e8f upstream.
>
> 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@xxxxxxxx>
> Fixes: 9d294a685fbc ("btrfs: zoned: enable to mount ZONED incompat flag")
> CC: stable@xxxxxxxxxxxxxxx # 5.12.x: e380adfc213a13: btrfs: zoned: pass start block to btrfs_use_zone_append
> CC: stable@xxxxxxxxxxxxxxx # 5.12.x
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
> Signed-off-by: David Sterba <dsterba@xxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

We found a bug in this patch, please drop it from 5.12 queue.