[SCSI] zfcp: Fix deadlock when adding invalid LUN
authorChristof Schmitt <christof.schmitt@de.ibm.com>
Mon, 5 Nov 2007 11:37:47 +0000 (12:37 +0100)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Sat, 12 Jan 2008 00:22:40 +0000 (18:22 -0600)
When adding an invalid LUN, there is a deadlock between the add
via scsi_scan_target and the slave_destroy handler: The handler
waits for the scan to complete, but for an invalid unit,
scsi_scan_target directly calls the slave_destroy handler.

Fix the deadlock by removing the wait in the slave_destroy
handler, it was not necessary anyway.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/s390/scsi/zfcp_aux.c
drivers/s390/scsi/zfcp_def.h
drivers/s390/scsi/zfcp_erp.c
drivers/s390/scsi/zfcp_scsi.c

index 00118499018b3c94d4c2834d45e6a8eb156be6f0..874b55ed00a3473f44a71227e69c33fa70eba04e 100644 (file)
@@ -844,8 +844,6 @@ zfcp_unit_enqueue(struct zfcp_port *port, fcp_lun_t fcp_lun)
        unit->sysfs_device.release = zfcp_sysfs_unit_release;
        dev_set_drvdata(&unit->sysfs_device, unit);
 
-       init_waitqueue_head(&unit->scsi_scan_wq);
-
        /* mark unit unusable as long as sysfs registration is not complete */
        atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status);
 
index 3d2d2dc0d6f8098e2fd0bfa1ab5439bf0d2e2902..294d0792e82b9bf4f765851b123f4803f8db9e2f 100644 (file)
@@ -983,10 +983,6 @@ struct zfcp_unit {
         struct scsi_device     *device;        /* scsi device struct pointer */
        struct zfcp_erp_action erp_action;     /* pending error recovery */
         atomic_t               erp_counter;
-       wait_queue_head_t      scsi_scan_wq;   /* can be used to wait until
-                                                 all scsi_scan_target
-                                                 requests have been
-                                                 completed. */
 };
 
 /* FSF request */
index 9c6ea9962cd2699116d8c85e9431b9beea1cb0ed..67d74ed0f25c5860f52ed618be3969ad1bbe66b7 100644 (file)
@@ -1609,7 +1609,6 @@ static void zfcp_erp_scsi_scan(struct work_struct *work)
        scsi_scan_target(&rport->dev, 0, rport->scsi_target_id,
                         unit->scsi_lun, 0);
        atomic_clear_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status);
-       wake_up(&unit->scsi_scan_wq);
        zfcp_unit_put(unit);
        kfree(p);
 }
index c6b6295395b0836d91148f81bc1fd7f712144602..3298fd35000cf9c1dccf73c96bd5d2de8132db8d 100644 (file)
@@ -180,9 +180,6 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt)
 
        if (unit) {
                zfcp_erp_wait(unit->port->adapter);
-               wait_event(unit->scsi_scan_wq,
-                          atomic_test_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING,
-                                           &unit->status) == 0);
                atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status);
                sdpnt->hostdata = NULL;
                unit->device = NULL;