From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bart Van Assche Subject: [PATCH v12 2/6] Avoid calling __scsi_remove_device() twice Date: Thu, 27 Jun 2013 16:53:48 +0200 Message-ID: <51CC51FC.5050901@acm.org> References: <51CC5176.90609@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from jacques.telenet-ops.be ([195.130.132.50]:55945 "EHLO jacques.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569Ab3F0Oxt (ORCPT ); Thu, 27 Jun 2013 10:53:49 -0400 In-Reply-To: <51CC5176.90609@acm.org> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org Cc: James Bottomley , Mike Christie , Hannes Reinecke , Chanho Min , Joe Lawrence , linux-scsi , David Milburn , Tejun Heo If something goes wrong during LUN scanning, e.g. a transport layer failure occurs, then __scsi_remove_device() can get invoked by the LUN scanning code for a SCSI device in state SDEV_CREATED_BLOCK. If this happens then the SCSI device has not yet been added to sysfs (is_visible == 0). Make sure that in that case the transition into state SDEV_DEL occurs. This avoids that __scsi_remove_device() gets invoked a second time by scsi_forget_host(). Signed-off-by: Bart Van Assche Cc: James Bottomley Cc: Mike Christie Cc: Hannes Reinecke Cc: Tejun Heo --- drivers/scsi/scsi_lib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index df8bd5a..124392f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2193,6 +2193,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) case SDEV_OFFLINE: case SDEV_TRANSPORT_OFFLINE: case SDEV_CANCEL: + case SDEV_CREATED_BLOCK: break; default: goto illegal; -- 1.7.10.4