[PATCH v1 3/3] scsi: Fix incorrect integrity sysfs values when HBA doesn't support DIX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For SCSI disks where the host bus adapter (HBA) does not support
Data Integrity Extensions (DIX), the write_generate and read_verify sysfs
attributes incorrectly report 1 instead of 0.

This happens because the BLK_INTEGRITY_NOGENERATE and
BLK_INTEGRITY_NOVERIFY flags are not explicitly set when DIX is disabled.
Fix this by properly setting these flags when DIX is not enabled.

Reported-by: M Nikhil <nikhilm@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/linux-block/f6130475-3ccd-45d2-abde-3ccceada0f0a@xxxxxxxxxxxxx/
Fixes: 9f4aa46f2a74 ("block: invert the BLK_INTEGRITY_{GENERATE,VERIFY} flags")
Signed-off-by: Anuj Gupta <anuj20.g@xxxxxxxxxxx>
---
 drivers/scsi/sd_dif.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index ae6ce6f5d622..be2cd06f500b 100644
--- a/drivers/scsi/sd_dif.c
+++ b/drivers/scsi/sd_dif.c
@@ -40,8 +40,10 @@ void sd_dif_config_host(struct scsi_disk *sdkp, struct queue_limits *lim)
 		dif = 0; dix = 1;
 	}
 
-	if (!dix)
+	if (!dix) {
+		bi->flags |= BLK_INTEGRITY_NOGENERATE | BLK_INTEGRITY_NOVERIFY;
 		return;
+	}
 
 	/* Enable DMA of protection information */
 	if (scsi_host_get_guard(sdkp->device->host) & SHOST_DIX_GUARD_IP)
-- 
2.25.1





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux