Skip to content

Commit 5266171

Browse files
steffen-maiergregkh
authored andcommitted
scsi: zfcp: fix capping of unsuccessful GPN_FT SAN response trace records
commit 975171b4461be296a35e83ebd748946b81cf0635 upstream. v4.9 commit aceeffbb59bb ("zfcp: trace full payload of all SAN records (req,resp,iels)") fixed trace data loss of 2.6.38 commit 2c55b75 ("[SCSI] zfcp: Redesign of the debug tracing for SAN records.") necessary for problem determination, e.g. to see the currently active zone set during automatic port scan. While it already saves space by not dumping any empty residual entries of the large successful GPN_FT response (4 pages), there are seldom cases where the GPN_FT response is unsuccessful and likely does not have FC_NS_FID_LAST set in fp_flags so we did not cap the trace record. We typically see such case for an initiator WWPN, which is not in any zone. Cap unsuccessful responses to at least the actual basic CT_IU response plus whatever fits the SAN trace record built-in "payload" buffer just in case there's trailing information of which we would at least see the existence and its beginning. In order not to erroneously cap successful responses, we need to swap calling the trace function and setting the CT / ELS status to success (0). Example trace record pair formatted with zfcpdbf: Timestamp : ... Area : SAN Subarea : 00 Level : 1 Exception : - CPU ID : .. Caller : 0x... Record ID : 1 Tag : fssct_1 Request ID : 0x<request_id> Destination ID : 0x00fffffc SAN req short : 01000000 fc020000 01720ffc 00000000 00000008 SAN req length : 20 | Timestamp : ... Area : SAN Subarea : 00 Level : 1 Exception : - CPU ID : .. Caller : 0x... Record ID : 2 Tag : fsscth2 Request ID : 0x<request_id> Destination ID : 0x00fffffc SAN resp short : 01000000 fc020000 80010000 00090700 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] SAN resp length: 16384 San resp info : 01000000 fc020000 80010000 00090700 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] 00000000 00000000 00000000 00000000 [trailing info] The fix saves all but one of the previously associated 64 PAYload trace record chunks of size 256 bytes each. Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com> Fixes: aceeffbb59bb ("zfcp: trace full payload of all SAN records (req,resp,iels)") Fixes: 2c55b75 ("[SCSI] zfcp: Redesign of the debug tracing for SAN records.") Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com> Signed-off-by: Benjamin Block <bblock@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d0c02c6 commit 5266171

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/s390/scsi/zfcp_dbf.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Debug traces for zfcp.
55
*
6-
* Copyright IBM Corp. 2002, 2016
6+
* Copyright IBM Corp. 2002, 2017
77
*/
88

99
#define KMSG_COMPONENT "zfcp"
@@ -447,6 +447,7 @@ static u16 zfcp_dbf_san_res_cap_len_if_gpn_ft(char *tag,
447447
struct fc_ct_hdr *reqh = sg_virt(ct_els->req);
448448
struct fc_ns_gid_ft *reqn = (struct fc_ns_gid_ft *)(reqh + 1);
449449
struct scatterlist *resp_entry = ct_els->resp;
450+
struct fc_ct_hdr *resph;
450451
struct fc_gpn_ft_resp *acc;
451452
int max_entries, x, last = 0;
452453

@@ -473,6 +474,13 @@ static u16 zfcp_dbf_san_res_cap_len_if_gpn_ft(char *tag,
473474
return len; /* not GPN_FT response so do not cap */
474475

475476
acc = sg_virt(resp_entry);
477+
478+
/* cap all but accept CT responses to at least the CT header */
479+
resph = (struct fc_ct_hdr *)acc;
480+
if ((ct_els->status) ||
481+
(resph->ct_cmd != cpu_to_be16(FC_FS_ACC)))
482+
return max(FC_CT_HDR_LEN, ZFCP_DBF_SAN_MAX_PAYLOAD);
483+
476484
max_entries = (reqh->ct_mr_size * 4 / sizeof(struct fc_gpn_ft_resp))
477485
+ 1 /* zfcp_fc_scan_ports: bytes correct, entries off-by-one
478486
* to account for header as 1st pseudo "entry" */;

drivers/s390/scsi/zfcp_fsf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,8 @@ static void zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *req)
928928

929929
switch (header->fsf_status) {
930930
case FSF_GOOD:
931-
zfcp_dbf_san_res("fsscth2", req);
932931
ct->status = 0;
932+
zfcp_dbf_san_res("fsscth2", req);
933933
break;
934934
case FSF_SERVICE_CLASS_NOT_SUPPORTED:
935935
zfcp_fsf_class_not_supp(req);
@@ -1109,8 +1109,8 @@ static void zfcp_fsf_send_els_handler(struct zfcp_fsf_req *req)
11091109

11101110
switch (header->fsf_status) {
11111111
case FSF_GOOD:
1112-
zfcp_dbf_san_res("fsselh1", req);
11131112
send_els->status = 0;
1113+
zfcp_dbf_san_res("fsselh1", req);
11141114
break;
11151115
case FSF_SERVICE_CLASS_NOT_SUPPORTED:
11161116
zfcp_fsf_class_not_supp(req);

0 commit comments

Comments
 (0)