From patchwork Fri Aug 4 10:42:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 711091 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 84AB5C04A94 for ; Fri, 4 Aug 2023 10:44:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229658AbjHDKoK (ORCPT ); Fri, 4 Aug 2023 06:44:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231506AbjHDKoF (ORCPT ); Fri, 4 Aug 2023 06:44:05 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 267EC49C6 for ; Fri, 4 Aug 2023 03:44:04 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1bb775625e2so13817765ad.1 for ; Fri, 04 Aug 2023 03:44:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1691145843; x=1691750643; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=HJR2kBqkL+XghNr00VtxOJPnSg1lGqtIyKNPpCOLxzs=; b=IkwdI+OgXUax2maKU3WdUwC9pSJHbowMeVAbWL/1g3PuYWBKcgot+/VHXdfsR90sC2 kYyMzMScJmpSfc27z0yZPw+4/51rmkY9XNVvlZy2OvBzrMkSzphBaBeOFHC4KWOlUlrT hDWcU1E9Gy99we7zFbRob97+QPkoieZkUWanI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691145843; x=1691750643; 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=HJR2kBqkL+XghNr00VtxOJPnSg1lGqtIyKNPpCOLxzs=; b=ccHfKWcy20kGRih7z/JL5Hl3oFKCNAkwZJsCzUgf0mA055uIMdDb6fUOxjFrnXGDW7 ChpxZLqM94vDSirqgD7BzPSlIzSMXLpwOUVQBhC6ePzzzR4coxSuX+w/39oUKUcMTC3n l3GirtzZM4VjJCDZwDNntUICirijF/sUuGDoSyAI9GiHsULwHvO8RXVYzi+fTMha3vAI aasaRrWAXTy07ttjJOIjehk6gOF0kY0ve91+WbsZjHzXTXWiyDNXq5ekmo0u+sBL6b0Z YfMeJq7krrq7GQO4sA0kidzocPWET6vnx6fSM1IdP0AGwDXGJlEpXJ3OZJFjoO6pGk20 xQ8A== X-Gm-Message-State: AOJu0YxwGZnuy2kWNOwQ3CqLvllYzM5A30kFR+rqOAdahFg9Vdxjb6zh iwWp1d4kcIsVfJ7TR0ztGrWF1PXum/sND2GHJ32P380psF6ZMcGLzVryodQGnOHQDs/Pf35EspZ hTvqEB1Thtq+EM7rpLtFBS2pPINazJDoa1bTiZTeyaPzuJ8ME8kXaQTZ1XroDPTuB4vVSnIIDqx d39trXmMaxyw== X-Google-Smtp-Source: AGHT+IHXzoXTvA6C2UZ0ZDnDjb0izL9MVTI8ZCINTg5sJZri1I2Zs0bft4CaIbnQ6zw7tAo2EfqoLQ== X-Received: by 2002:a17:902:db10:b0:1b8:8682:62fb with SMTP id m16-20020a170902db1000b001b8868262fbmr2093127plx.4.1691145843212; Fri, 04 Aug 2023 03:44:03 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id jb15-20020a170903258f00b001bb988ac243sm1424463plb.297.2023.08.04.03.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 03:44:02 -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, chandrakanth.patil@broadcom.com, Ranjan Kumar Subject: [PATCH v3 5/6] mpi3mr: Enhance handling of devices removed after controller reset Date: Fri, 4 Aug 2023 16:12:47 +0530 Message-Id: <20230804104248.118924-6-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230804104248.118924-1-ranjan.kumar@broadcom.com> References: <20230804104248.118924-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 fcf0888232e7..89ba015c5d7e 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) {