From patchwork Wed Jul 12 11:59:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 13310263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6414EB64D9 for ; Wed, 12 Jul 2023 12:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233163AbjGLMBr (ORCPT ); Wed, 12 Jul 2023 08:01:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233395AbjGLMBY (ORCPT ); Wed, 12 Jul 2023 08:01:24 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE178E42 for ; Wed, 12 Jul 2023 05:01:08 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-53fa455cd94so3618329a12.2 for ; Wed, 12 Jul 2023 05:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1689163268; x=1691755268; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=5Sc32J/rubyEtkHKJ2nxzEpCzT0+79T4B/KP8uzQ8oE=; b=Nbl9jUJrpLzRUorjkYclb0sNhjU4HSjrY4bdM7JlA90i9oTLt4hrV2JLVSjGRC5ZY/ erVkj5xu4zxHD9uTnLRewrtj2sKFgO6h65jk+nJ9V6LrGiIrkqQeW+KpY832mCfPL9lR F1JICOEGCMcest0cG28jM21zCL8Orpbs4yAW8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689163268; x=1691755268; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5Sc32J/rubyEtkHKJ2nxzEpCzT0+79T4B/KP8uzQ8oE=; b=Sjp+2ZiaumoIEGMaC5HkcqlZNOt+DxHtJeN0Fi5DjyEAGeulvxg+l9yuc3nS60ktoN MZX6uXtKo2bPSljQKW1fXKc1wOFipERnP40gJM+B3rJ4pqrQs139u58HXHvRLnIYp6Iv L8EkPKkcMSIP3XBekBVDje/27X8QEdDUi5vskBwLbqB5yc6uo7UTAMS/OgUZgmfWZ78w te0ZYEPpCe7TcWqiyYxcDvisBQejNGZCkFK6FUreKQ5jomkmTdYkxo3OFJsX2qs7FWFj Cv51QlMdvDsi1dMKDmyKwvfO73ofNhsdKTLO1XlHb5+jY9LSQbHy5nIXjwhbGVT6k1L4 91XA== X-Gm-Message-State: ABy/qLY9Ebk69fGJRvTuu5xiS+hbdhNEI/d6m+zqGex3ynMWVdXS0lU+ PiSo2TCAhzxlzAzmRjTKsKaJAqHo1h4t01jcMS9YvukBSjP1aw3Z7GEp4uzycyT1pa19ScQJ1gc XfGIAKyKYNVhbWq4o6nMWlgragzC45FHB1J7Tk54xfFxKjsRPp3Oer+edD15y0qEDHbHKC0uX/L 3n1DTc2NiOEg== X-Google-Smtp-Source: APBJJlEBXQWjB/z6E0awNruRTfyj/aMMI6rKMTjGiu6yvMLk7I/3VOcxMVs8VNDI48JPCaBwtfrvvQ== X-Received: by 2002:a17:902:ec88:b0:1b5:532e:33b8 with SMTP id x8-20020a170902ec8800b001b5532e33b8mr15469152plg.35.1689163267403; Wed, 12 Jul 2023 05:01:07 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id x7-20020a1709029a4700b001b531e8a000sm3799627plv.157.2023.07.12.05.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 05:01:06 -0700 (PDT) From: Ranjan Kumar To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: rajsekhar.chundru@broadcom.com, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, sreekanth.reddy@broadcom.com, chandrakanth.patil@broadcom.com, Ranjan Kumar Subject: [PATCH 5/6] mpi3mr: Enhance handling of devices removed after controller reset Date: Wed, 12 Jul 2023 17:29:54 +0530 Message-Id: <20230712115955.6312-6-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230712115955.6312-1-ranjan.kumar@broadcom.com> References: <20230712115955.6312-1-ranjan.kumar@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Mark all of the devices that are exposed to the OS prior to a controller reset and not detected by the controller after the reset as removed devices and the I/Os to those devices are unblocked (and returned with DID_NO_CONNECT) prior to removing the devices one after the other. Signed-off-by: Ranjan Kumar --- drivers/scsi/mpi3mr/mpi3mr_os.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 62acda8d1d3c..fe5dcdd8fcce 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -1041,6 +1041,19 @@ mpi3mr_update_sdev(struct scsi_device *sdev, void *data) void mpi3mr_rfresh_tgtdevs(struct mpi3mr_ioc *mrioc) { struct mpi3mr_tgt_dev *tgtdev, *tgtdev_next; + struct mpi3mr_stgt_priv_data *tgt_priv; + + dprint_reset(mrioc, "refresh target devices: check for removals\n"); + list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list, + list) { + if ((tgtdev->dev_handle == MPI3MR_INVALID_DEV_HANDLE) && + tgtdev->host_exposed && tgtdev->starget && + tgtdev->starget->hostdata) { + tgt_priv = tgtdev->starget->hostdata; + tgt_priv->dev_removed = 1; + atomic_set(&tgt_priv->block_io, 0); + } + } list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list, list) {