From patchwork Thu Aug 4 13:12:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 596005 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 103D6C3F6B0 for ; Thu, 4 Aug 2022 13:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239613AbiHDNBK (ORCPT ); Thu, 4 Aug 2022 09:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239767AbiHDNA6 (ORCPT ); Thu, 4 Aug 2022 09:00:58 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 019E163AE for ; Thu, 4 Aug 2022 06:00:57 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id f28so11045456pfk.1 for ; Thu, 04 Aug 2022 06:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc; bh=5lr/V3IcGYlzcMMUX0zaLSFXZuNQJVAbCP0x+AtM52U=; b=cLkB25K4Qg3eoev7jVEBzGsGBrUzL2ejk8h9ISpQBJQNZzQ/tWzyQwBFmiD6OR4Vsm V2ISYFAJB9LL023vuPmvdxDXFKUTz4t4Ty77qCehBsFOdTiaKP1vkig4gmNRyz2nzhjW QrOfXdpTpLXVoRAApJ6+hWiPHhHOwnAQOEUlM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=5lr/V3IcGYlzcMMUX0zaLSFXZuNQJVAbCP0x+AtM52U=; b=yDW6mVrIh9lSvhG1HRiIfrlejDs8U27pGXwBi5PWeXocq315ob0R7En51lQ6c1RYHw JGBbRXLzeSceOKW7uezUQ1P1Sc7wpGyCPFCA3IK6vc8nmpKJIExBU1v03dLKUBtTKaTD SAjHBPna40xgIOzA7mJpY/5aoqrGe5xSbByy7+y7jSZVvW8pNvszNApjDjArlqFl4wuj F1bhtrdSZDZh41GjXoAmx9M13TjAJkrGmNgytP1LStLk1JJgDf5SMY6DPjg5QVTZDlSL Y/x67GL2pS2Zo/XTTKiKVUCOohaTUYaiJlhBA4TNKHs/4JyCIwKPpAal4zRvH1wxRDxU S9uQ== X-Gm-Message-State: ACgBeo2FylbTfnyedRj8boLfCR03j1cz2y7WJuQM/YphHKGHpWcPFqOG 6ow0FxjKsaIHsr58CeYADxgzCAQABkGkaMvMGsNmIq1Njq5lXNx31Unu1jrDeILGMAGRddvS9XU 6BG4mlN92GsDJMhkpHTvTDaLPKKOoEgBj1JBwLTcjHLfJYlYppD2cpsGgrHUguTfYS0aodmhX8q szZ4daqOmq X-Google-Smtp-Source: AA6agR4l0K515mxZKhV7WRNpskTFLEg5X1lN3RAeyoiq3kbcZq5Dpk4Ka7bJ0Q82W3MQV7x5rO/hAg== X-Received: by 2002:a05:6a00:2484:b0:52b:2be0:2191 with SMTP id c4-20020a056a00248400b0052b2be02191mr1645318pfv.51.1659618056090; Thu, 04 Aug 2022 06:00:56 -0700 (PDT) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w15-20020aa7954f000000b0052e2a1edab8sm934645pfq.24.2022.08.04.06.00.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 06:00:55 -0700 (PDT) From: Sreekanth Reddy To: linux-scsi@vger.kernel.org Cc: martin.petersen@oracle.com, Sreekanth Reddy , Himanshu Madhani Subject: [PATCH v2 15/15] mpi3mr: Block IOs while refreshing target dev objects Date: Thu, 4 Aug 2022 18:42:26 +0530 Message-Id: <20220804131226.16653-16-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220804131226.16653-1-sreekanth.reddy@broadcom.com> References: <20220804131226.16653-1-sreekanth.reddy@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Block the IOs on the target devices until corresponding target device's target dev objects are refreshed as part of post controller reset operation. Reviewed-by: Himanshu Madhani Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpi3mr/mpi3mr_os.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 4c8ef9f..e7c461e 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -424,6 +424,8 @@ void mpi3mr_invalidate_devhandles(struct mpi3mr_ioc *mrioc) tgt_priv->io_throttle_enabled = 0; tgt_priv->io_divert = 0; tgt_priv->throttle_group = NULL; + if (tgtdev->host_exposed) + atomic_set(&tgt_priv->block_io, 1); } } } @@ -835,6 +837,7 @@ void mpi3mr_remove_tgtdev_from_host(struct mpi3mr_ioc *mrioc, __func__, tgtdev->dev_handle, (unsigned long long)tgtdev->wwid); if (tgtdev->starget && tgtdev->starget->hostdata) { tgt_priv = tgtdev->starget->hostdata; + atomic_set(&tgt_priv->block_io, 0); tgt_priv->dev_handle = MPI3MR_INVALID_DEV_HANDLE; } @@ -1077,6 +1080,8 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, scsi_tgt_priv_data->dev_type = tgtdev->dev_type; scsi_tgt_priv_data->io_throttle_enabled = tgtdev->io_throttle_enabled; + if (is_added == true) + atomic_set(&scsi_tgt_priv_data->block_io, 0); } switch (dev_pg0->access_status) { @@ -4577,6 +4582,16 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, stgt_priv_data = sdev_priv_data->tgt_priv_data; + if (atomic_read(&stgt_priv_data->block_io)) { + if (mrioc->stop_drv_processing) { + scmd->result = DID_NO_CONNECT << 16; + scsi_done(scmd); + goto out; + } + retval = SCSI_MLQUEUE_DEVICE_BUSY; + goto out; + } + dev_handle = stgt_priv_data->dev_handle; if (dev_handle == MPI3MR_INVALID_DEV_HANDLE) { scmd->result = DID_NO_CONNECT << 16; @@ -4589,16 +4604,6 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, goto out; } - if (atomic_read(&stgt_priv_data->block_io)) { - if (mrioc->stop_drv_processing) { - scmd->result = DID_NO_CONNECT << 16; - scsi_done(scmd); - goto out; - } - retval = SCSI_MLQUEUE_DEVICE_BUSY; - goto out; - } - if (stgt_priv_data->dev_type == MPI3_DEVICE_DEVFORM_PCIE) is_pcie_dev = 1; if ((scmd->cmnd[0] == UNMAP) && is_pcie_dev &&