Skip to content

Commit 1e793f6

Browse files
kadesai16martinkpetersen
authored andcommitted
scsi: megaraid_sas: Fix data integrity failure for JBOD (passthrough) devices
Commit 02b01e0 ("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: 02b01e0 CC: stable@vger.kernel.org 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>
1 parent 77f18a8 commit 1e793f6

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

drivers/scsi/megaraid/megaraid_sas_base.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,16 +1700,13 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
17001700
goto out_done;
17011701
}
17021702

1703-
switch (scmd->cmnd[0]) {
1704-
case SYNCHRONIZE_CACHE:
1705-
/*
1706-
* FW takes care of flush cache on its own
1707-
* No need to send it down
1708-
*/
1703+
/*
1704+
* FW takes care of flush cache on its own for Virtual Disk.
1705+
* No need to send it down for VD. For JBOD send SYNCHRONIZE_CACHE to FW.
1706+
*/
1707+
if ((scmd->cmnd[0] == SYNCHRONIZE_CACHE) && MEGASAS_IS_LOGICAL(scmd)) {
17091708
scmd->result = DID_OK << 16;
17101709
goto out_done;
1711-
default:
1712-
break;
17131710
}
17141711

17151712
return instance->instancet->build_and_issue_cmd(instance, scmd);

0 commit comments

Comments
 (0)