diff mbox

scsi: introduce a quirk for false cache reporting

Message ID yq18tw4rpsy.fsf@sermon.lab.mkp.net (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Martin K. Petersen Aug. 11, 2016, 2:40 a.m. UTC
>>>>> "Oliver" == Oliver Neukum <oneukum@suse.com> writes:

Oliver> Some SATA to USB bridges fail to cooperate with some drives
Oliver> resulting in no cache being present being reported to the
Oliver> host. That causes the host to skip sending a command to
Oliver> synchronize caches. That causes data loss when the drive is
Oliver> powered down.


I must be missing something. How is always_sync different from just
setting wce_default_on?

Comments

Oliver Neukum Aug. 14, 2016, 3:27 p.m. UTC | #1
On Wed, 2016-08-10 at 22:40 -0400, Martin K. Petersen wrote:
> >>>>> "Oliver" == Oliver Neukum <oneukum@suse.com> writes:
> 
> Oliver> Some SATA to USB bridges fail to cooperate with some drives
> Oliver> resulting in no cache being present being reported to the
> Oliver> host. That causes the host to skip sending a command to
> Oliver> synchronize caches. That causes data loss when the drive is
> Oliver> powered down.
> 
> diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
> index a6c346d..392d166 100644
> --- a/include/scsi/scsi_device.h
> +++ b/include/scsi/scsi_device.h
> @@ -179,6 +179,7 @@ struct scsi_device {
>  	unsigned try_rc_10_first:1;	/* Try READ_CAPACACITY_10 first */
>  	unsigned is_visible:1;	/* is the device visible in sysfs */
>  	unsigned wce_default_on:1;	/* Cache is ON by default */
> +	unsigned always_sync:1;		/* synchronize cache in every case*/
>  	unsigned no_dif:1;	/* T10 PI (DIF) should be disabled */
>  	unsigned broken_fua:1;		/* Don't set FUA bit */
>  	unsigned lun_in_cdb:1;		/* Store LUN bits in CDB[1] */
> 
> I must be missing something. How is always_sync different from just
> setting wce_default_on?

Hi,

wce_default_on controls the default if the device provides no
indication. The problem here is that the indication the device
provides must be overridden, as they are false.

	Regards
		Oliver


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Martin K. Petersen Aug. 16, 2016, 4:44 a.m. UTC | #2
>>>>> "Oliver" == Oliver Neukum <oneukum@suse.com> writes:

Oliver,

Oliver> wce_default_on controls the default if the device provides no
Oliver> indication. The problem here is that the indication the device
Oliver> provides must be overridden, as they are false.

Can't you just blacklist the mode select on the device in question?

Something like:

	if (us->fflags & US_FL_ALWAYS_SYNC) {
		sdev->skip_ms_page_3f = 1;
		sdev->skip_ms_page_8 = 1;
		sdev->wce_default_on = 1;
	}

?
Oliver Neukum Aug. 16, 2016, 10:28 a.m. UTC | #3
On Tue, 2016-08-16 at 00:44 -0400, Martin K. Petersen wrote:
> >>>>> "Oliver" == Oliver Neukum <oneukum@suse.com> writes:
> 
> Oliver,
> 
> Oliver> wce_default_on controls the default if the device provides no
> Oliver> indication. The problem here is that the indication the device
> Oliver> provides must be overridden, as they are false.
> 
> Can't you just blacklist the mode select on the device in question?
> 
> Something like:
> 
> 	if (us->fflags & US_FL_ALWAYS_SYNC) {
> 		sdev->skip_ms_page_3f = 1;
> 		sdev->skip_ms_page_8 = 1;
> 		sdev->wce_default_on = 1;
> 	}
> 
> ?

Hi,

this looks like a workable option. I am preparing a patch.

	Regards
		Oliver




--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index a6c346d..392d166 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -179,6 +179,7 @@  struct scsi_device {
 	unsigned try_rc_10_first:1;	/* Try READ_CAPACACITY_10 first */
 	unsigned is_visible:1;	/* is the device visible in sysfs */
 	unsigned wce_default_on:1;	/* Cache is ON by default */
+	unsigned always_sync:1;		/* synchronize cache in every case*/
 	unsigned no_dif:1;	/* T10 PI (DIF) should be disabled */
 	unsigned broken_fua:1;		/* Don't set FUA bit */
 	unsigned lun_in_cdb:1;		/* Store LUN bits in CDB[1] */