Commit 9075faf1 authored by Kashyap Desai's avatar Kashyap Desai Committed by Greg Kroah-Hartman

scsi: megaraid_sas: Fix data integrity failure for JBOD (passthrough) devices

commit 1e793f6f upstream.

Commit 02b01e01 ("megaraid_sas: return sync cache call with
success") modified the driver to successfully complete SYNCHRONIZE_CACHE
commands without passing them to the controller. Disk drive caches are
only explicitly managed by controller firmware when operating in RAID
mode. So this commit effectively disabled writeback cache flushing for
any drives used in JBOD mode, leading to data integrity failures.

[mkp: clarified patch description]

Fixes: 02b01e01Signed-off-by: default avatarKashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarEwan D. Milne <emilne@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d9237e75
...@@ -1688,16 +1688,13 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd) ...@@ -1688,16 +1688,13 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
goto out_done; goto out_done;
} }
switch (scmd->cmnd[0]) {
case SYNCHRONIZE_CACHE:
/* /*
* FW takes care of flush cache on its own * FW takes care of flush cache on its own for Virtual Disk.
* No need to send it down * No need to send it down for VD. For JBOD send SYNCHRONIZE_CACHE to FW.
*/ */
if ((scmd->cmnd[0] == SYNCHRONIZE_CACHE) && MEGASAS_IS_LOGICAL(scmd)) {
scmd->result = DID_OK << 16; scmd->result = DID_OK << 16;
goto out_done; goto out_done;
default:
break;
} }
if (instance->instancet->build_and_issue_cmd(instance, scmd)) { if (instance->instancet->build_and_issue_cmd(instance, scmd)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment