dm crypt: Fix zoned block device support
authorDamien Le Moal <damien.lemoal@wdc.com>
Tue, 25 May 2021 21:25:01 +0000 (06:25 +0900)
committerMike Snitzer <snitzer@redhat.com>
Fri, 4 Jun 2021 16:07:38 +0000 (12:07 -0400)
commitf34ee1dce642c67104a56d562e6ec71efe901f77
treee44b80b9572adf5123b633eec8fd4b1837d24d64
parentbb37d77239af25cde59693dbe3fac04dd17d7b29
dm crypt: Fix zoned block device support

Zone append BIOs (REQ_OP_ZONE_APPEND) always specify the start sector
of the zone to be written instead of the actual sector location to
write. The write location is determined by the device and returned to
the host upon completion of the operation. This interface, while simple
and efficient for writing into sequential zones of a zoned block
device, is incompatible with the use of sector values to calculate a
cypher block IV. All data written in a zone end up using the same IV
values corresponding to the first sectors of the zone, but read
operation will specify any sector within the zone resulting in an IV
mismatch between encryption and decryption.

To solve this problem, report to DM core that zone append operations are
not supported. This result in the zone append operations being emulated
using regular write operations.

Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-crypt.c