Commit d2458740 authored by Sreekanth Reddy's avatar Sreekanth Reddy Committed by Greg Kroah-Hartman

scsi: mpt3sas: Fix for block device of raid exists even after deleting raid disk

commit 6d3a56ed upstream.

While merging mpt3sas & mpt2sas code, we added the is_warpdrive check
condition on the wrong line

---------------------------------------------------------------------------
 scsih_target_alloc(struct scsi_target *starget)
                        sas_target_priv_data->handle = raid_device->handle;
                        sas_target_priv_data->sas_address = raid_device->wwid;
                        sas_target_priv_data->flags |= MPT_TARGET_FLAGS_VOLUME;
-                       raid_device->starget = starget;
+                       sas_target_priv_data->raid_device = raid_device;
+                       if (ioc->is_warpdrive)
+                               raid_device->starget = starget;
                }
                spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
                return 0;
------------------------------------------------------------------------------

That check should be for the line sas_target_priv_data->raid_device =
raid_device;

Due to above hunk, we are not initializing raid_device's starget for
raid volumes, and so during raid disk deletion driver is not calling
scsi_remove_target() API as driver observes starget field of
raid_device's structure as NULL.
Signed-off-by: default avatarSreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Fixes: 7786ab6a ("mpt3sas: Ported WarpDrive product SSS6200 support")
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6e897d03
...@@ -1275,9 +1275,9 @@ scsih_target_alloc(struct scsi_target *starget) ...@@ -1275,9 +1275,9 @@ scsih_target_alloc(struct scsi_target *starget)
sas_target_priv_data->handle = raid_device->handle; sas_target_priv_data->handle = raid_device->handle;
sas_target_priv_data->sas_address = raid_device->wwid; sas_target_priv_data->sas_address = raid_device->wwid;
sas_target_priv_data->flags |= MPT_TARGET_FLAGS_VOLUME; sas_target_priv_data->flags |= MPT_TARGET_FLAGS_VOLUME;
sas_target_priv_data->raid_device = raid_device;
if (ioc->is_warpdrive) if (ioc->is_warpdrive)
raid_device->starget = starget; sas_target_priv_data->raid_device = raid_device;
raid_device->starget = starget;
} }
spin_unlock_irqrestore(&ioc->raid_device_lock, flags); spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment