Commit 5767a1c498931417e69e663ddd5e110cbaabec32

Authored by Kleber Sacilotto de Souza
Committed by James Bottomley
1 parent c299190b93

[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: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

... ... @@ -1301,7 +1301,7 @@
1301 1301 ipr_clear_res_target(res);
1302 1302 list_move_tail(&res->queue, &ioa_cfg->free_res_q);
1303 1303 }
1304   - } else if (!res->sdev) {
  1304 + } else if (!res->sdev || res->del_from_ml) {
1305 1305 res->add_to_ml = 1;
1306 1306 if (ioa_cfg->allow_ml_add_del)
1307 1307 schedule_work(&ioa_cfg->work_q);
... ... @@ -3104,7 +3104,10 @@
3104 3104 did_work = 1;
3105 3105 sdev = res->sdev;
3106 3106 if (!scsi_device_get(sdev)) {
3107   - list_move_tail(&res->queue, &ioa_cfg->free_res_q);
  3107 + if (!res->add_to_ml)
  3108 + list_move_tail(&res->queue, &ioa_cfg->free_res_q);
  3109 + else
  3110 + res->del_from_ml = 0;
3108 3111 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3109 3112 scsi_remove_device(sdev);
3110 3113 scsi_device_put(sdev);