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@xxxxxxxxxxxx> Signed-off-by: Sreekanth Reddy <sreekanth.reddy@xxxxxxxxxxxx> --- 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); -- 2.31.1
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature