summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKashyap Desai <kashyap.desai@broadcom.com>2016-10-21 06:33:32 -0700
committerBen Hutchings <ben@decadent.org.uk>2017-02-23 03:54:20 +0000
commit1ee24cf8904d9553e785c71889468a1c80d1a75d (patch)
tree2bd265aeca967edfd41536a37f513fe855436c04
parent47e1befd550ccacf735afb640d17cf55e4d4b8ec (diff)
downloadlinux-stable-1ee24cf8904d9553e785c71889468a1c80d1a75d.tar.gz
linux-stable-1ee24cf8904d9553e785c71889468a1c80d1a75d.tar.bz2
linux-stable-1ee24cf8904d9553e785c71889468a1c80d1a75d.zip
scsi: megaraid_sas: Fix data integrity failure for JBOD (passthrough) devices
commit 1e793f6fc0db920400574211c48f9157a37e3945 upstream. Commit 02b01e010afe ("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: 02b01e010afeeb49328d35650d70721d2ca3fd59 Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com> Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Ewan D. Milne <emilne@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 0f6f296eaff9..55036079d074 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1586,16 +1586,13 @@ megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd
goto out_done;
}
- switch (scmd->cmnd[0]) {
- case SYNCHRONIZE_CACHE:
- /*
- * FW takes care of flush cache on its own
- * No need to send it down
- */
+ /*
+ * FW takes care of flush cache on its own for Virtual Disk.
+ * 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;
goto out_done;
- default:
- break;
}
if (instance->instancet->build_and_issue_cmd(instance, scmd)) {