From patchwork Sun Oct 7 08:35:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 10629415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D034316B1 for ; Sun, 7 Oct 2018 08:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFBB129150 for ; Sun, 7 Oct 2018 08:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3DA1291A0; Sun, 7 Oct 2018 08:35:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BB9229150 for ; Sun, 7 Oct 2018 08:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727989AbeJGPmT (ORCPT ); Sun, 7 Oct 2018 11:42:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:47108 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726637AbeJGPmT (ORCPT ); Sun, 7 Oct 2018 11:42:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 94413AE7E; Sun, 7 Oct 2018 08:35:45 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , linux-scsi@vger.kernel.org, Chad Dupuis , Arun Easi , Hannes Reinecke Subject: [PATCH 1/3] scsi: Allow state transitions from OFFLINE to BLOCKED Date: Sun, 7 Oct 2018 10:35:35 +0200 Message-Id: <20181007083537.89131-2-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181007083537.89131-1-hare@suse.de> References: <20181007083537.89131-1-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hannes Reinecke When an RSCN gets delayed (or not being sent at all) the transport class will detect an error, EH kicks in, and eventually will be setting the device to offline. If we receive an RSCN after that the device will stay in 'offline'. This patch allows for an 'offline' to 'blocked' transition, thereby allowing the device to become active again. Signed-off-by: Hannes Reinecke --- drivers/scsi/scsi_lib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index aaa1819b0a69..7db3c5fae469 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2764,6 +2764,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) switch (oldstate) { case SDEV_RUNNING: case SDEV_CREATED_BLOCK: + case SDEV_OFFLINE: break; default: goto illegal; From patchwork Sun Oct 7 08:35:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 10629419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8CF9A14BD for ; Sun, 7 Oct 2018 08:35:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BC7629150 for ; Sun, 7 Oct 2018 08:35:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FE1A29199; Sun, 7 Oct 2018 08:35:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1546C29150 for ; Sun, 7 Oct 2018 08:35:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728000AbeJGPmU (ORCPT ); Sun, 7 Oct 2018 11:42:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:47120 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727686AbeJGPmT (ORCPT ); Sun, 7 Oct 2018 11:42:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8F83CADD8; Sun, 7 Oct 2018 08:35:45 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , linux-scsi@vger.kernel.org, Chad Dupuis , Arun Easi , Thomas Abraham Subject: [PATCH 2/3] libfc: check fc_frame_payload_get() return value for null Date: Sun, 7 Oct 2018 10:35:36 +0200 Message-Id: <20181007083537.89131-3-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181007083537.89131-1-hare@suse.de> References: <20181007083537.89131-1-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thomas Abraham We should not assume the payload of a PRLI or PLOGI respons is always present. Signed-off-by: Thomas Abraham Reviewed-by: Hannes Reinecke Reviewed-by: Arun Easi --- drivers/scsi/libfc/fc_rport.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 372387a450df..e400783ebb87 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c @@ -1038,8 +1038,11 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp, struct fc_els_ls_rjt *rjt; rjt = fc_frame_payload_get(fp, sizeof(*rjt)); - FC_RPORT_DBG(rdata, "PLOGI ELS rejected, reason %x expl %x\n", - rjt->er_reason, rjt->er_explan); + if (!rjt) + FC_RPORT_DBG(rdata, "PLOGI bad response\n"); + else + FC_RPORT_DBG(rdata, "PLOGI ELS rejected, reason %x expl %x\n", + rjt->er_reason, rjt->er_explan); fc_rport_error_retry(rdata, -FC_EX_ELS_RJT); } out: @@ -1211,8 +1214,11 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, } else { rjt = fc_frame_payload_get(fp, sizeof(*rjt)); - FC_RPORT_DBG(rdata, "PRLI ELS rejected, reason %x expl %x\n", - rjt->er_reason, rjt->er_explan); + if (!rjt) + FC_RPORT_DBG(rdata, "PRLI bad response\n"); + else + FC_RPORT_DBG(rdata, "PRLI ELS rejected, reason %x expl %x\n", + rjt->er_reason, rjt->er_explan); fc_rport_error_retry(rdata, FC_EX_ELS_RJT); } From patchwork Sun Oct 7 08:35:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 10629417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2685184E for ; Sun, 7 Oct 2018 08:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D13AD29193 for ; Sun, 7 Oct 2018 08:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5DA0291AA; Sun, 7 Oct 2018 08:35:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AEE229193 for ; Sun, 7 Oct 2018 08:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727996AbeJGPmT (ORCPT ); Sun, 7 Oct 2018 11:42:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:47116 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726874AbeJGPmT (ORCPT ); Sun, 7 Oct 2018 11:42:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8F99DAE66; Sun, 7 Oct 2018 08:35:45 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , linux-scsi@vger.kernel.org, Chad Dupuis , Arun Easi , Hannes Reinecke Subject: [PATCH 3/3] libfc: retry PRLI if we cannot analyse the payload Date: Sun, 7 Oct 2018 10:35:37 +0200 Message-Id: <20181007083537.89131-4-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181007083537.89131-1-hare@suse.de> References: <20181007083537.89131-1-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hannes Reinecke When we fail to analyse the payload of a PRLI response we should reset the state machine to retry the PRLI; eventually we will be getting a proper frame. Not doing so will result in a stuck state machine and the port never to be presented to the systsm. Suggested-by: Chad Dupuis Signed-off-by: Hannes Reinecke Reviewed-by: Arun Easi --- drivers/scsi/libfc/fc_rport.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index e400783ebb87..1e1c0f1b9e69 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c @@ -1161,8 +1161,10 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, op = fc_frame_payload_op(fp); if (op == ELS_LS_ACC) { pp = fc_frame_payload_get(fp, sizeof(*pp)); - if (!pp) + if (!pp) { + fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR); goto out; + } resp_code = (pp->spp.spp_flags & FC_SPP_RESP_MASK); FC_RPORT_DBG(rdata, "PRLI spp_flags = 0x%x spp_type 0x%x\n", @@ -1175,8 +1177,10 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp, fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR); goto out; } - if (pp->prli.prli_spp_len < sizeof(pp->spp)) + if (pp->prli.prli_spp_len < sizeof(pp->spp)) { + fc_rport_error_retry(rdata, -FC_EX_SEQ_ERR); goto out; + } fcp_parm = ntohl(pp->spp.spp_params); if (fcp_parm & FCP_SPPF_RETRY)