Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1111402imm; Wed, 1 Aug 2018 10:21:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe3rzniz0ibiJvqrVmxM88MHTawV7pUGU0FciQetzDjs+Sp++8Mia9hj1d9r8Ucrh/XEtHP X-Received: by 2002:a17:902:bd93:: with SMTP id q19-v6mr25359372pls.238.1533144111034; Wed, 01 Aug 2018 10:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144111; cv=none; d=google.com; s=arc-20160816; b=T4dccPun4BUQvrHwvRYuwKmMsjX0G9gywIIEGKH3MeEHqr1LIG80WPZuT6ZIGnqXBt uIJIhWRmaFmmgVw78c+w/4jBAnIljQz0ICnaUPMPnMtEDFB3tadYjkGbHBONo0oPw49X hsl0N89RIEv1I+dChCn5YoRaHw5dz1Me+7Pwn++UdVBJoOKgF+YjLYo9phTV+kLG0+SQ d3SzpOb+fmAtAZf4h8VIE2NFdokLFSRnlLSE/2znBCQv5GL6EFm5J6gACVD++L1FlURI 3TB24PGFZaYGLtugCVNcEPqvgZCtHkYbblZVV781qTC8X/73H2dzenBneU2o44RPlEOy RsRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=8dNdvd8qwc5AiiZm3p3c1vXPtl1xn0In5vso+zWDqNo=; b=0mepfmZgtiv4JnJH5txBhbcytL9tZkOkYIwoD7/98P2ixqSDQwVLGVlTI0qqJ2QXYi G0Y0jhY/17It5dUThajmErg6vLQeqnJuHv9ysgSb89cWtUfTGnulAM2G/gE/e7GJ1Z3d eUC62RByNAZpJ4hJ6LSLb6Mpxcwg1ouum23+F9lFRv20/IOjsjQt+WF378Hl11rToRT4 HwEuZxqRlujinOKS8YIPpELmaSj6Kmuc+c+tujwfVPo6G8xAcr/OZp4gPVZTRkoIsqcW ZRIerJ4TMpD2jHwueDEMFNJPoJ8zlmrAt5w4aHmLzBwk9uUVRg/jSFKRf0YYXpjozcVj CSEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e188-v6si9569501pfe.231.2018.08.01.10.21.36; Wed, 01 Aug 2018 10:21:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405299AbeHATGh (ORCPT + 99 others); Wed, 1 Aug 2018 15:06:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48858 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404595AbeHATGg (ORCPT ); Wed, 1 Aug 2018 15:06:36 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EE033D40; Wed, 1 Aug 2018 17:19:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chad Dupuis , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 164/246] scsi: qedf: Set the UNLOADING flag when removing a vport Date: Wed, 1 Aug 2018 18:51:14 +0200 Message-Id: <20180801165019.594804994@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chad Dupuis [ Upstream commit 4f4616ceebaf045c59e8a6aa01f08826d18d5c63 ] Similar to what we do when we remove a PCI function, set the QEDF_UNLOADING flag to prevent any requests from being queued while a vport is being deleted. This prevents any requests from getting stuck in limbo when the vport is unloaded or deleted. Fixes the crash: PID: 106676 TASK: ffff9a436aa90000 CPU: 12 COMMAND: "multipathd" #0 [ffff9a43567d3550] machine_kexec+522 at ffffffffaca60b2a #1 [ffff9a43567d35b0] __crash_kexec+114 at ffffffffacb13512 #2 [ffff9a43567d3680] crash_kexec+48 at ffffffffacb13600 #3 [ffff9a43567d3698] oops_end+168 at ffffffffad117768 #4 [ffff9a43567d36c0] no_context+645 at ffffffffad106f52 #5 [ffff9a43567d3710] __bad_area_nosemaphore+116 at ffffffffad106fe9 #6 [ffff9a43567d3760] bad_area+70 at ffffffffad107379 #7 [ffff9a43567d3788] __do_page_fault+1247 at ffffffffad11a8cf #8 [ffff9a43567d37f0] do_page_fault+53 at ffffffffad11a915 #9 [ffff9a43567d3820] page_fault+40 at ffffffffad116768 [exception RIP: qedf_init_task+61] RIP: ffffffffc0e13c2d RSP: ffff9a43567d38d0 RFLAGS: 00010046 RAX: 0000000000000000 RBX: ffffbe920472c738 RCX: ffff9a434fa0e3e8 RDX: ffff9a434f695280 RSI: ffffbe920472c738 RDI: ffff9a43aa359c80 RBP: ffff9a43567d3950 R8: 0000000000000c15 R9: ffff9a3fb09b9880 R10: ffff9a434fa0e3e8 R11: ffff9a43567d35ce R12: 0000000000000000 R13: ffff9a434f695280 R14: ffff9a43aa359c80 R15: ffff9a3fb9e005c0 ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 Signed-off-by: Chad Dupuis Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qedf/qedf_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1649,6 +1649,15 @@ static int qedf_vport_destroy(struct fc_ struct Scsi_Host *shost = vport_to_shost(vport); struct fc_lport *n_port = shost_priv(shost); struct fc_lport *vn_port = vport->dd_data; + struct qedf_ctx *qedf = lport_priv(vn_port); + + if (!qedf) { + QEDF_ERR(NULL, "qedf is NULL.\n"); + goto out; + } + + /* Set unloading bit on vport qedf_ctx to prevent more I/O */ + set_bit(QEDF_UNLOADING, &qedf->flags); mutex_lock(&n_port->lp_mutex); list_del(&vn_port->list); @@ -1675,6 +1684,7 @@ static int qedf_vport_destroy(struct fc_ if (vn_port->host) scsi_host_put(vn_port->host); +out: return 0; }