From patchwork Mon Jul 24 13:23:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 706085 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 2FE24C001B0 for ; Mon, 24 Jul 2023 13:24:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231361AbjGXNYn (ORCPT ); Mon, 24 Jul 2023 09:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231426AbjGXNYc (ORCPT ); Mon, 24 Jul 2023 09:24:32 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02E781987 for ; Mon, 24 Jul 2023 06:24:16 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1b89cfb4571so35013975ad.3 for ; Mon, 24 Jul 2023 06:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1690205056; x=1690809856; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=i72eFS1GDPL956i90D8LRL2lrjE77swb2314EDvkE24=; b=X4K5tgbsmTB0xilkKU+l7U57E23f+GNtUOFR6GpWGam6/+ogLTCslh7NijjQppgRur +74JGWnOZvYx8qJ8IU51/gdUi21VEeNGh79K2icGgmYWHFZ0Scvf2eRmbuWISrbbZaUD n7ROc7L/wDY57KdRQiWb5jKGZxoBnCIZ1BZJ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690205056; x=1690809856; 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=i72eFS1GDPL956i90D8LRL2lrjE77swb2314EDvkE24=; b=YiO2zjKXjzainNKqoMk1Jh2/DKDW4OQOjRrWyJCfY82H7lYvuojwTGQ9IJS0ud0cVg zmJwtt+OUSUSNK2BEJy7r2suxNKnL4cJteqjSwp1Pzwyu1XNAqK7s5lPPlRVKam0WJKR akg8OT2gGCBp5SWFnR2SbNSX4jl06AiDknfYBxxpS0S3vHGUsX6i7zXced/qSyi9rbXd /jDHS6VEZ+7D6rNSRzhCuyAMqyLHmAnjV0xvsfl6G8psF/evZrw/i3HvVKbFdyfe6/6r ocpYbeznHDfc8Uh0pByzKuX7JoGu2o0sOL8MQpVE2qcAXTa9+dnoahMhdil10lkWlS4Q meOA== X-Gm-Message-State: ABy/qLaXh0D0QX0PO4I9j07iAWuVsJkUzA6lVnIZRPKem488e+32dENZ STiCXa0OXUZETA/Jm3YRddyWViPKu5/8R7fdxcsfbX5xP04b/NIhu13hkyFSJsaL8ys0+nXcM9d ShJMYXZ7MkdaZtEX4leSQrs6hz3PECAjPaAMxwdLG9EShWKeo0WWMLsQYLHDLMWyvjzUzCF1JfW CFi66Op8HdfA== X-Google-Smtp-Source: APBJJlFA3gjthZ0jebbtla/1s7GwZWJPcHgoKwZmvA1t86TvcEJc+/UlZhB9PclqusTaJ2qYOATMWA== X-Received: by 2002:a17:902:ba8a:b0:1b8:a7ec:396a with SMTP id k10-20020a170902ba8a00b001b8a7ec396amr9241282pls.17.1690205055964; Mon, 24 Jul 2023 06:24:15 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id s8-20020a170902ea0800b001b9e0918b0asm8917887plg.169.2023.07.24.06.24.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 06:24:15 -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, sreekanth.reddy@broadcom.com, Ranjan Kumar Subject: [PATCH v1 5/6] mpi3mr: Enhance handling of devices removed after controller reset Date: Mon, 24 Jul 2023 18:53:02 +0530 Message-Id: <20230724132303.19470-6-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230724132303.19470-1-ranjan.kumar@broadcom.com> References: <20230724132303.19470-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 080c1a958905..14b289fb4823 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) {