From: Hans-Joachim Picht <hpicht@redhat.com> Date: Mon, 10 Dec 2007 14:03:30 +0100 Subject: [s390] zfcp: Deadlock when adding invalid LUN Message-id: 20071210130330.GB29540@redhat.com O-Subject: [RHEL5 U2 PATCH 2/8] s390 - zfcp: Deadlock when adding invalid LUN Bugzilla: 412841 RH-Acked-by: Pete Zaitcev <zaitcev@redhat.com> Description ============ After adding an invalid LUN to zfcp, this LUN can not be removed again, the sysfs write for removal returs ENODEV. The unit_add calls internally scsi_add_device, this function calls the zfcp slave_destroy handler after determining that the unit does not exist. The zfcp slave_destroy handler waits for the scsi_add_device call to complete and we have a deadlock. The problem is fixed removing the wait in the zfcp slave_destroy handler. It was not required anyway and this resolves the deadlock. Bugzilla ========= BZ 412841 https://bugzilla.redhat.com/show_bug.cgi?id=412841 Upstream status of the patch: ============================= The patch is already upstream in the scsi-misc tree, commit d858b526c5e638b0f29d05eb885df65e18ec6cc8 Test status: ============ Kernel with patch was built and successfully tested Please ACK. With best regards, Hans diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index af0327d..40f385c 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c @@ -182,9 +182,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;