Skip to contentSkip to conversation

mptsas: fixed hot-removal processing

PATCH In review Kei Tokunaga 2 participants 3 messages Apr 7, 2010 – Jul 20, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mptsas: fixed hot-removal processing

Hi Kashyap,

This patch fixes mptsas disk hot-removal processing. The hot-removal processing doesn't complete because of this condition.

drivers/message/fusion/mptsas.c:
mptsas_taskmgmt_complete()

  if ((mptsas_find_vtarget(ioc, channel, id)) && !ioc->fw_events_off)
    mptsas_queue_device_delete(...);

mptsas_queue_device_delete(), which must be called for hot-removal, never gets called because mptsas_find_vtarget() always returns 0 here. At that time, the vtarget has already been freed in mptsas_target_destroy(), and also the scsi_device has been marked as SDEV_DEL.

As a result of the issue, port deletion functions won't get called and the device ends up being in an incomplete state. (Some data structures and sysfs entries, which should be removed in hot-removal, remain.) One side effect of this is that a hot-addition of the device (bringing the device back on) fails.

This patch just removes mptsas_find_vtarget() from the if-state condition.

This applies to 2.6.34-rc3.

Thanks,
Kei

---

 linux-2.6.34-rc3-kei/drivers/message/fusion/mptsas.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/message/fusion/mptsas.c renamed from drivers/message/fusion/mptsas.c~fix-mptsas_hot_removal +1 -1
diff -puN drivers/message/fusion/mptsas.c~fix-mptsas_hot_removal drivers/message/fusion/mptsas.c
@@ -1221,7 +1221,7 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *io
 	 * enable work queue to remove device from upper layers
 	 */
 	list_del(&target_reset_list->list);
-	if ((mptsas_find_vtarget(ioc, channel, id)) && !ioc->fw_events_off)
+	if (!ioc->fw_events_off)
 		mptsas_queue_device_delete(ioc,
 			&target_reset_list->sas_event_data);
 

_

#1 lore raw
Quoted 24 lines · Kei Tokunaga

Hi Kashyap,

This patch fixes mptsas disk hot-removal processing. The hot-removal processing doesn't complete because of this condition.

drivers/message/fusion/mptsas.c:
mptsas_taskmgmt_complete()

  if ((mptsas_find_vtarget(ioc, channel, id)) && !ioc->fw_events_off)
    mptsas_queue_device_delete(...);

mptsas_queue_device_delete(), which must be called for hot-removal, never gets called because mptsas_find_vtarget() always returns 0 here. At that time, the vtarget has already been freed in mptsas_target_destroy(), and also the scsi_device has been marked as SDEV_DEL.

As a result of the issue, port deletion functions won't get called and the device ends up being in an incomplete state. (Some data structures and sysfs entries, which should be removed in hot-removal, remain.) One side effect of this is that a hot-addition of the device (bringing the device back on) fails.

Quoted 4 lines

This patch just removes mptsas_find_vtarget() from the if-state condition.

This applies to 2.6.34-rc3.

Kashyap, can you please give it an ACK? I confirmed it still applies to the latest git tree (scsi-misc-2.6).

Thanks,
Kei

Quoted 25 lines

---

 linux-2.6.34-rc3-kei/drivers/message/fusion/mptsas.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/message/fusion/mptsas.c~fix-mptsas_hot_removal drivers/message/fusion/mptsas.c

drivers/message/fusion/mptsas.c renamed from drivers/message/fusion/mptsas.c~fix-mptsas_hot_removal +1 -1
@@ -1221,7 +1221,7 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *io
 	 * enable work queue to remove device from upper layers
 	 */
 	list_del(&target_reset_list->list);
-	if ((mptsas_find_vtarget(ioc, channel, id)) && !ioc->fw_events_off)
+	if (!ioc->fw_events_off)
 		mptsas_queue_device_delete(ioc,
 			&target_reset_list->sas_event_data);
 

_

#2 lore raw
Quoted 34 lines

-----Original Message-----
From: Kei Tokunaga [mailto:[email protected]]
Sent: Tuesday, July 20, 2010 6:00 AM
To: Desai, Kashyap
Cc: linux-scsi; Kei Tokunaga
Subject: Re: [PATCH] mptsas: fixed hot-removal processing

Quoted 24 lines · Kei Tokunaga

Hi Kashyap,

This patch fixes mptsas disk hot-removal processing. The hot-removal processing doesn't complete because of this condition.

drivers/message/fusion/mptsas.c:
mptsas_taskmgmt_complete()

  if ((mptsas_find_vtarget(ioc, channel, id)) && !ioc->fw_events_off)
    mptsas_queue_device_delete(...);

mptsas_queue_device_delete(), which must be called for hot-removal, never gets called because mptsas_find_vtarget() always returns 0 here. At that time, the vtarget has already been freed in mptsas_target_destroy(), and also the scsi_device has been marked as SDEV_DEL.

As a result of the issue, port deletion functions won't get called and the device ends up being in an incomplete state. (Some data structures and sysfs entries, which should be removed in hot-removal, remain.) One side effect of this is that a hot-addition of the device (bringing the device back on) fails.

Quoted 7 lines
Quoted 4 lines

This patch just removes mptsas_find_vtarget() from the if-state condition.

This applies to 2.6.34-rc3.

Kashyap, can you please give it an ACK? I confirmed it still applies to the latest git tree (scsi-misc-2.6).

Kei,
This patch has valid code change. I have also validated patch works fine for your explained case. Please consider this patch as ACKed.

James, Can we have this patch committed in next merge window?

~Kashyap

Quoted 34 lines

Thanks,
Kei

Quoted 7 lines

---

 linux-2.6.34-rc3-kei/drivers/message/fusion/mptsas.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/message/fusion/mptsas.c~fix-mptsas_hot_removal

drivers/message/fusion/mptsas.c

Quoted 1 line

--- linux-2.6.34-rc3/drivers/message/fusion/mptsas.c~fix-

mptsas_hot_removal 2010-04-07 16:47:36.000000000 +0900

Quoted 1 line

+++ linux-2.6.34-rc3-kei/drivers/message/fusion/mptsas.c 2010-04-07

16:48:17.000000000 +0900

Quoted 17 lines
drivers/message/fusion/mptsas.c renamed from drivers/message/fusion/mptsas.c~fix-mptsas_hot_removal +1 -1
@@ -1221,7 +1221,7 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *io
 	 * enable work queue to remove device from upper layers
 	 */
 	list_del(&target_reset_list->list);
-	if ((mptsas_find_vtarget(ioc, channel, id)) && !ioc-
 fw_events_off)
+	if (!ioc->fw_events_off)
 		mptsas_queue_device_delete(ioc,
 			&target_reset_list->sas_event_data);

_