summaryrefslogtreecommitdiff
path: root/drivers/md/dm-crypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-crypt.c')
-rw-r--r--drivers/md/dm-crypt.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index b0ab080f2567..50f4cbd600d5 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -3138,11 +3138,10 @@ static int crypt_report_zones(struct dm_target *ti,
struct dm_report_zones_args *args, unsigned int nr_zones)
{
struct crypt_config *cc = ti->private;
- sector_t sector = cc->start + dm_target_offset(ti, args->next_sector);
- args->start = cc->start;
- return blkdev_report_zones(cc->dev->bdev, sector, nr_zones,
- dm_report_zones_cb, args);
+ return dm_report_zones(cc->dev->bdev, cc->start,
+ cc->start + dm_target_offset(ti, args->next_sector),
+ args, nr_zones);
}
#else
#define crypt_report_zones NULL
@@ -3281,14 +3280,28 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
}
cc->start = tmpll;
- /*
- * For zoned block devices, we need to preserve the issuer write
- * ordering. To do so, disable write workqueues and force inline
- * encryption completion.
- */
if (bdev_is_zoned(cc->dev->bdev)) {
+ /*
+ * For zoned block devices, we need to preserve the issuer write
+ * ordering. To do so, disable write workqueues and force inline
+ * encryption completion.
+ */
set_bit(DM_CRYPT_NO_WRITE_WORKQUEUE, &cc->flags);
set_bit(DM_CRYPT_WRITE_INLINE, &cc->flags);
+
+ /*
+ * All zone append writes to a zone of a zoned block device will
+ * have the same BIO sector, the start of the zone. When the
+ * cypher IV mode uses sector values, all data targeting a
+ * zone will be encrypted using the first sector numbers of the
+ * zone. This will not result in write errors but will
+ * cause most reads to fail as reads will use the sector values
+ * for the actual data locations, resulting in IV mismatch.
+ * To avoid this problem, ask DM core to emulate zone append
+ * operations with regular writes.
+ */
+ DMDEBUG("Zone append operations will be emulated");
+ ti->emulate_zone_append = true;
}
if (crypt_integrity_aead(cc) || cc->integrity_iv_size) {