From patchwork Fri Feb 24 14:43:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 656744 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 D56C9C61DA3 for ; Fri, 24 Feb 2023 14:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229991AbjBXOoH (ORCPT ); Fri, 24 Feb 2023 09:44:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbjBXOoB (ORCPT ); Fri, 24 Feb 2023 09:44:01 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83AE918A80 for ; Fri, 24 Feb 2023 06:43:55 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id h17-20020a17090aea9100b0023739b10792so2939647pjz.1 for ; Fri, 24 Feb 2023 06:43:55 -0800 (PST) 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:subject:date:message-id:reply-to; bh=slaWFwj4cB/UGM60JVm/FD1e2tIlLMvz16eScB7rFTk=; b=bqr/hHyq9qugeTh7Ttg/nkew9ME7Nw5ZazKML2M24McTamdroMb2gVxpkOlyi9i7TR JDTXZd9azSsqQrMMk0FBX4+A61EMLSrje6Z0IJfXHNt5QDPUvOu+mLcMVQzJhEi/wu62 499zQ8YGXvPjK7N33rozHz1xIsh9C1LVnb9Mw= 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:subject:date:message-id:reply-to; bh=slaWFwj4cB/UGM60JVm/FD1e2tIlLMvz16eScB7rFTk=; b=lR221sDXgYe66+nK5ZC3PIQLpdchDHIxwkP4eZ+erLsIWxxKjzHzJHgjjDSRe85wuk FASoNSIhJxkoUCcWfQBmu12u1LjfvLp+ZJ6JCyh6BZEdGTK+2u/FybHE3bxg8zQ+e7kL qRufaeP7o3NajtJaUqcxs1eix64huwxj6rY14iHdvmcSqztx8H3jIXgu0SmDFSl5mH5k MBIMWOcDhHqrYTMGiP2hOClNVUPcFtSoyD6mwO/SwOksjcjDdCSfDV/OZI3FO3cZrB8W 1vlFPXsXfOwPEbaxBea38hDTp4FcQ2KimHyGQpKrGSRvPDvOl3uSO9zX+xXQmY64PaXQ YOuQ== X-Gm-Message-State: AO0yUKWwCVCXMUTFPoDbVqoGsjjNmsL/+Qcs+uuBghum+bgwZ6/zAdAo brgVge45ziWgeRS97LJDkBa3YP1umIY2e207nfIYi9Tws8yRw+jpCc1fNejpU+gvKTAKVVmI+t+ 4GQUy66TmZPnMwcBEGqm3RBm1xY13btZdF3cU1nD5RSiLVFe0xTzLDPAjy2qSjwn+3TUTVDkRsn eXv3aUPxA= X-Google-Smtp-Source: AK7set9l5DUmYjD0zC0ok0VIC72mhxFzZyR31sWi5PtVUC5sea4dk6MQCYYF03IixRlZrHeomRM+Ew== X-Received: by 2002:a17:902:7405:b0:19c:d23e:52a0 with SMTP id g5-20020a170902740500b0019cd23e52a0mr2933494pll.14.1677249834663; Fri, 24 Feb 2023 06:43:54 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id b5-20020a170902a9c500b00186748fe6ccsm8911549plr.214.2023.02.24.06.43.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 06:43:54 -0800 (PST) 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, Ranjan Kumar , Sreekanth Reddy Subject: [PATCH 01/15] mpi3mr: Support for Clean device removal of drives Date: Fri, 24 Feb 2023 06:43:06 -0800 Message-Id: <20230224144320.10601-2-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230224144320.10601-1-ranjan.kumar@broadcom.com> References: <20230224144320.10601-1-ranjan.kumar@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org As part of clean device removal procedure, user will first delete the device from Block layer before removing it physically. When user deletes the device from Block layer then driver set the corresponding device's starget object as NULL.when user physically removes the device then driver is not unregistering device with SCSI Transport Layer (STL) as it unregisters the device only if the corresponding device's starget is non-NULL and this leads to unexpected behaviors. Update the driver to unregister the device with STL even if starget object is NULL.So that driver can support clean device removal procedure. Signed-off-by: Ranjan Kumar Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpi3mr/mpi3mr_os.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 3306de7170f6..dd3a84f73e1b 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -1281,10 +1281,9 @@ static void mpi3mr_devstatuschg_evt_bh(struct mpi3mr_ioc *mrioc, if (!tgtdev->host_exposed) mpi3mr_report_tgtdev_to_host(mrioc, tgtdev->perst_id); } - if (tgtdev->starget && tgtdev->starget->hostdata) { - if (delete) - mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); - } + if (delete) + mpi3mr_remove_tgtdev_from_host(mrioc, tgtdev); + if (cleanup) { mpi3mr_tgtdev_del_from_list(mrioc, tgtdev); mpi3mr_tgtdev_put(tgtdev);