Skip to content

Commit 74da693

Browse files
steffen-maiergregkh
authored andcommitted
scsi: zfcp: fix missing SCSI trace for result of eh_host_reset_handler
commit df30781 upstream. For problem determination we need to see whether and why we were successful or not. This allows deduction of scsi_eh escalation. Example trace record formatted with zfcpdbf from s390-tools: Timestamp : ... Area : SCSI Subarea : 00 Level : 1 Exception : - CPU ID : .. Caller : 0x... Record ID : 1 Tag : schrh_r SCSI host reset handler result Request ID : 0x0000000000000000 none (invalid) SCSI ID : 0xffffffff none (invalid) SCSI LUN : 0xffffffff none (invalid) SCSI LUN high : 0xffffffff none (invalid) SCSI result : 0x00002002 field re-used for midlayer value: SUCCESS or in other cases: 0x2009 == FAST_IO_FAIL SCSI retries : 0xff none (invalid) SCSI allowed : 0xff none (invalid) SCSI scribble : 0xffffffffffffffff none (invalid) SCSI opcode : ffffffff ffffffff ffffffff ffffffff none (invalid) FCP rsp inf cod: 0xff none (invalid) FCP rsp IU : 00000000 00000000 00000000 00000000 none (invalid) 00000000 00000000 v2.6.35 commit a1dbfdd ("[SCSI] zfcp: Pass return code from fc_block_scsi_eh to scsi eh") introduced the first return with something other than the previously hardcoded single SUCCESS return path. Signed-off-by: Steffen Maier <[email protected]> Fixes: a1dbfdd ("[SCSI] zfcp: Pass return code from fc_block_scsi_eh to scsi eh") Cc: <[email protected]> #2.6.38+ Reviewed-by: Jens Remus <[email protected]> Reviewed-by: Benjamin Block <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9db2ad7 commit 74da693

File tree

3 files changed

+48
-5
lines changed

3 files changed

+48
-5
lines changed

drivers/s390/scsi/zfcp_dbf.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,46 @@ void zfcp_dbf_scsi(char *tag, int level, struct scsi_cmnd *sc,
664664
spin_unlock_irqrestore(&dbf->scsi_lock, flags);
665665
}
666666

667+
/**
668+
* zfcp_dbf_scsi_eh() - Trace event for special cases of scsi_eh callbacks.
669+
* @tag: Identifier for event.
670+
* @adapter: Pointer to zfcp adapter as context for this event.
671+
* @scsi_id: SCSI ID/target to indicate scope of task management function (TMF).
672+
* @ret: Return value of calling function.
673+
*
674+
* This SCSI trace variant does not depend on any of:
675+
* scsi_cmnd, zfcp_fsf_req, scsi_device.
676+
*/
677+
void zfcp_dbf_scsi_eh(char *tag, struct zfcp_adapter *adapter,
678+
unsigned int scsi_id, int ret)
679+
{
680+
struct zfcp_dbf *dbf = adapter->dbf;
681+
struct zfcp_dbf_scsi *rec = &dbf->scsi_buf;
682+
unsigned long flags;
683+
static int const level = 1;
684+
685+
if (unlikely(!debug_level_enabled(adapter->dbf->scsi, level)))
686+
return;
687+
688+
spin_lock_irqsave(&dbf->scsi_lock, flags);
689+
memset(rec, 0, sizeof(*rec));
690+
691+
memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
692+
rec->id = ZFCP_DBF_SCSI_CMND;
693+
rec->scsi_result = ret; /* re-use field, int is 4 bytes and fits */
694+
rec->scsi_retries = ~0;
695+
rec->scsi_allowed = ~0;
696+
rec->fcp_rsp_info = ~0;
697+
rec->scsi_id = scsi_id;
698+
rec->scsi_lun = (u32)ZFCP_DBF_INVALID_LUN;
699+
rec->scsi_lun_64_hi = (u32)(ZFCP_DBF_INVALID_LUN >> 32);
700+
rec->host_scribble = ~0;
701+
memset(rec->scsi_opcode, 0xff, ZFCP_DBF_SCSI_OPCODE);
702+
703+
debug_event(dbf->scsi, level, rec, sizeof(*rec));
704+
spin_unlock_irqrestore(&dbf->scsi_lock, flags);
705+
}
706+
667707
static debug_info_t *zfcp_dbf_reg(const char *name, int size, int rec_size)
668708
{
669709
struct debug_info *d;

drivers/s390/scsi/zfcp_ext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ extern void zfcp_dbf_san_res(char *, struct zfcp_fsf_req *);
5252
extern void zfcp_dbf_san_in_els(char *, struct zfcp_fsf_req *);
5353
extern void zfcp_dbf_scsi(char *, int, struct scsi_cmnd *,
5454
struct zfcp_fsf_req *);
55+
extern void zfcp_dbf_scsi_eh(char *tag, struct zfcp_adapter *adapter,
56+
unsigned int scsi_id, int ret);
5557

5658
/* zfcp_erp.c */
5759
extern void zfcp_erp_set_adapter_status(struct zfcp_adapter *, u32);

drivers/s390/scsi/zfcp_scsi.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,15 +323,16 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
323323
{
324324
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
325325
struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
326-
int ret;
326+
int ret = SUCCESS, fc_ret;
327327

328328
zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
329329
zfcp_erp_wait(adapter);
330-
ret = fc_block_scsi_eh(scpnt);
331-
if (ret)
332-
return ret;
330+
fc_ret = fc_block_scsi_eh(scpnt);
331+
if (fc_ret)
332+
ret = fc_ret;
333333

334-
return SUCCESS;
334+
zfcp_dbf_scsi_eh("schrh_r", adapter, ~0, ret);
335+
return ret;
335336
}
336337

337338
struct scsi_transport_template *zfcp_scsi_transport_template;

0 commit comments

Comments
 (0)