Commit 5767a1c4 authored by Kleber Sacilotto de Souza's avatar Kleber Sacilotto de Souza Committed by James Bottomley

[SCSI] ipr: Fix a race on multiple configuration changes

In a multiple configuration change scenario a remove notification can be
followed by an immediate add notification for the same device, which
will cause the device to be removed but never added back. This patch
fixes the problem by ensuring that in such situations the device will be
added back.
Signed-off-by: default avatarKleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Acked-by: default avatarBrian King <brking@linux.vnet.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent c299190b
...@@ -1301,7 +1301,7 @@ static void ipr_handle_config_change(struct ipr_ioa_cfg *ioa_cfg, ...@@ -1301,7 +1301,7 @@ static void ipr_handle_config_change(struct ipr_ioa_cfg *ioa_cfg,
ipr_clear_res_target(res); ipr_clear_res_target(res);
list_move_tail(&res->queue, &ioa_cfg->free_res_q); list_move_tail(&res->queue, &ioa_cfg->free_res_q);
} }
} else if (!res->sdev) { } else if (!res->sdev || res->del_from_ml) {
res->add_to_ml = 1; res->add_to_ml = 1;
if (ioa_cfg->allow_ml_add_del) if (ioa_cfg->allow_ml_add_del)
schedule_work(&ioa_cfg->work_q); schedule_work(&ioa_cfg->work_q);
...@@ -3104,7 +3104,10 @@ static void ipr_worker_thread(struct work_struct *work) ...@@ -3104,7 +3104,10 @@ static void ipr_worker_thread(struct work_struct *work)
did_work = 1; did_work = 1;
sdev = res->sdev; sdev = res->sdev;
if (!scsi_device_get(sdev)) { if (!scsi_device_get(sdev)) {
if (!res->add_to_ml)
list_move_tail(&res->queue, &ioa_cfg->free_res_q); list_move_tail(&res->queue, &ioa_cfg->free_res_q);
else
res->del_from_ml = 0;
spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
scsi_remove_device(sdev); scsi_remove_device(sdev);
scsi_device_put(sdev); scsi_device_put(sdev);
......
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