]>
Commit | Line | Data |
---|---|---|
721db3cc GKH |
1 | From 71b8e45da51a7b64a23378221c0a5868bd79da4f Mon Sep 17 00:00:00 2001 |
2 | From: Steffen Maier <maier@linux.vnet.ibm.com> | |
3 | Date: Fri, 28 Jul 2017 12:30:51 +0200 | |
4 | Subject: scsi: zfcp: fix queuecommand for scsi_eh commands when DIX enabled | |
5 | ||
6 | From: Steffen Maier <maier@linux.vnet.ibm.com> | |
7 | ||
8 | commit 71b8e45da51a7b64a23378221c0a5868bd79da4f upstream. | |
9 | ||
10 | Since commit db007fc5e20c ("[SCSI] Command protection operation"), | |
11 | scsi_eh_prep_cmnd() saves scmd->prot_op and temporarily resets it to | |
12 | SCSI_PROT_NORMAL. | |
13 | Other FCP LLDDs such as qla2xxx and lpfc shield their queuecommand() | |
14 | to only access any of scsi_prot_sg...() if | |
15 | (scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL). | |
16 | ||
17 | Do the same thing for zfcp, which introduced DIX support with | |
18 | commit ef3eb71d8ba4 ("[SCSI] zfcp: Introduce experimental support for | |
19 | DIF/DIX"). | |
20 | ||
21 | Otherwise, TUR SCSI commands as part of scsi_eh likely fail in zfcp, | |
22 | because the regular SCSI command with DIX protection data, that scsi_eh | |
23 | re-uses in scsi_send_eh_cmnd(), of course still has | |
24 | (scsi_prot_sg_count() != 0) and so zfcp sends down bogus requests to the | |
25 | FCP channel hardware. | |
26 | ||
27 | This causes scsi_eh_test_devices() to have (finish_cmds == 0) | |
28 | [not SCSI device is online or not scsi_eh_tur() failed] | |
29 | so regular SCSI commands, that caused / were affected by scsi_eh, | |
30 | are moved to work_q and scsi_eh_test_devices() itself returns false. | |
31 | In turn, it unnecessarily escalates in our case in scsi_eh_ready_devs() | |
32 | beyond host reset to finally scsi_eh_offline_sdevs() | |
33 | which sets affected SCSI devices offline with the following kernel message: | |
34 | ||
35 | "kernel: sd H:0:T:L: Device offlined - not ready after error recovery" | |
36 | ||
37 | Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com> | |
38 | Fixes: ef3eb71d8ba4 ("[SCSI] zfcp: Introduce experimental support for DIF/DIX") | |
39 | Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com> | |
40 | Signed-off-by: Benjamin Block <bblock@linux.vnet.ibm.com> | |
41 | Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> | |
42 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
43 | ||
44 | --- | |
45 | drivers/s390/scsi/zfcp_fsf.c | 3 ++- | |
46 | 1 file changed, 2 insertions(+), 1 deletion(-) | |
47 | ||
48 | --- a/drivers/s390/scsi/zfcp_fsf.c | |
49 | +++ b/drivers/s390/scsi/zfcp_fsf.c | |
50 | @@ -2258,7 +2258,8 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd * | |
51 | fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; | |
52 | zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd, 0); | |
53 | ||
54 | - if (scsi_prot_sg_count(scsi_cmnd)) { | |
55 | + if ((scsi_get_prot_op(scsi_cmnd) != SCSI_PROT_NORMAL) && | |
56 | + scsi_prot_sg_count(scsi_cmnd)) { | |
57 | zfcp_qdio_set_data_div(qdio, &req->qdio_req, | |
58 | scsi_prot_sg_count(scsi_cmnd)); | |
59 | retval = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, |