Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54b2b50c authored by Martin K. Petersen's avatar Martin K. Petersen Committed by James Bottomley
Browse files

[SCSI] Disable WRITE SAME for RAID and virtual host adapter drivers



Some host adapters do not pass commands through to the target disk
directly. Instead they provide an emulated target which may or may not
accurately report its capabilities. In some cases the physical device
characteristics are reported even when the host adapter is processing
commands on the device's behalf. This can lead to adapter firmware hangs
or excessive I/O errors.

This patch disables WRITE SAME for devices connected to host adapters
that provide an emulated target. Driver writers can disable WRITE SAME
by setting the no_write_same flag in the host adapter template.

[jejb: fix up rejections due to eh_deadline patch]
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Cc: stable@kernel.org
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent ae5fbae0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3625,6 +3625,7 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
		shost->max_lun = 1;
		shost->max_channel = 1;
		shost->max_cmd_len = 16;
		shost->no_write_same = 1;

		/* Schedule policy is determined by ->qc_defer()
		 * callback and it needs to see every deferred qc.
+1 −0
Original line number Diff line number Diff line
@@ -1623,6 +1623,7 @@ static struct scsi_host_template scsi_driver_template = {
	.cmd_per_lun		= 1,
	.can_queue		= 1,
	.sdev_attrs		= sbp2_scsi_sysfs_attrs,
	.no_write_same		= 1,
};

MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
+2 −1
Original line number Diff line number Diff line
@@ -2025,7 +2025,8 @@ static struct scsi_host_template driver_template = {
	.cmd_per_lun		= TW_MAX_CMDS_PER_LUN,
	.use_clustering		= ENABLE_CLUSTERING,
	.shost_attrs		= twa_host_attrs,
	.emulated		= 1
	.emulated		= 1,
	.no_write_same		= 1,
};

/* This function will probe and initialize a card */
+2 −1
Original line number Diff line number Diff line
@@ -1600,7 +1600,8 @@ static struct scsi_host_template driver_template = {
	.cmd_per_lun		= TW_MAX_CMDS_PER_LUN,
	.use_clustering		= ENABLE_CLUSTERING,
	.shost_attrs		= twl_host_attrs,
	.emulated		= 1
	.emulated		= 1,
	.no_write_same		= 1,
};

/* This function will probe and initialize a card */
+2 −1
Original line number Diff line number Diff line
@@ -2279,7 +2279,8 @@ static struct scsi_host_template driver_template = {
	.cmd_per_lun		= TW_MAX_CMDS_PER_LUN,	
	.use_clustering		= ENABLE_CLUSTERING,
	.shost_attrs		= tw_host_attrs,
	.emulated		= 1
	.emulated		= 1,
	.no_write_same		= 1,
};

/* This function will probe and initialize a card */
Loading