diff mbox series

[01/15] mpi3mr: Support for Clean device removal of drives

Message ID 20230224144320.10601-2-ranjan.kumar@broadcom.com
State New
Headers show
Series mpi3mr: Few Enhancements and minor fixes | expand

Commit Message

Ranjan Kumar Feb. 24, 2023, 2:43 p.m. UTC
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 <ranjan.kumar@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

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);