linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	Christof Schmitt <christof.schmitt@de.ibm.com>
Subject: [patch 02/10] zfcp: Remove SCSI device when removing unit
Date: Fri, 16 Jul 2010 15:37:35 +0200	[thread overview]
Message-ID: <20100716134300.006377000@de.ibm.com> (raw)
In-Reply-To: 20100716133733.621672000@de.ibm.com

[-- Attachment #1: 705-zfcp-unit-removal.diff --]
[-- Type: text/plain, Size: 2044 bytes --]

From: Christof Schmitt <christof.schmitt@de.ibm.com>

Configuring a LUN in zfcp, also creates a SCSI device. For
consistency, it makes sense to remove the SCSI device when the LUN is
deconfigured. Replace the flush_work with the call to
scsi_remove_device: scsi_remove_device also takes the scan_mutex that
synchronizes itself with any long running device discovery.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---

 drivers/s390/scsi/zfcp_def.h   |    1 +
 drivers/s390/scsi/zfcp_scsi.c  |    1 +
 drivers/s390/scsi/zfcp_sysfs.c |   10 ++++++++--
 3 files changed, 10 insertions(+), 2 deletions(-)

--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -212,6 +212,7 @@ struct zfcp_port {
 	struct work_struct     test_link_work;
 	struct work_struct     rport_work;
 	enum { RPORT_NONE, RPORT_ADD, RPORT_DEL }  rport_task;
+	unsigned int		starget_id;
 };
 
 struct zfcp_unit {
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -564,6 +564,7 @@ static void zfcp_scsi_rport_register(str
 	rport->maxframe_size = port->maxframe_size;
 	rport->supported_classes = port->supported_classes;
 	port->rport = rport;
+	port->starget_id = rport->scsi_target_id;
 
 	zfcp_scsi_queue_unit_register(port);
 }
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -290,6 +290,7 @@ static ssize_t zfcp_sysfs_unit_remove_st
 	struct zfcp_unit *unit;
 	u64 fcp_lun;
 	int retval = -EINVAL;
+	struct scsi_device *sdev;
 
 	if (!(port && get_device(&port->dev)))
 		return -EBUSY;
@@ -303,8 +304,13 @@ static ssize_t zfcp_sysfs_unit_remove_st
 	else
 		retval = 0;
 
-	/* wait for possible timeout during SCSI probe */
-	flush_work(&unit->scsi_work);
+	sdev = scsi_device_lookup(port->adapter->scsi_host, 0,
+				  port->starget_id,
+				  scsilun_to_int((struct scsi_lun *)&fcp_lun));
+	if (sdev) {
+		scsi_remove_device(sdev);
+		scsi_device_put(sdev);
+	}
 
 	write_lock_irq(&port->unit_list_lock);
 	list_del(&unit->list);


  parent reply	other threads:[~2010-07-16 13:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-16 13:37 [patch 00/10] zfcp updates for 2.6.36 merge window Christof Schmitt
2010-07-16 13:37 ` [patch 01/10] zfcp: Use memdup_user and kstrdup Christof Schmitt
2010-07-16 13:37 ` Christof Schmitt [this message]
2010-07-27 20:37   ` [patch 02/10] zfcp: Remove SCSI device when removing unit James Bottomley
2010-07-28  8:35     ` Christof Schmitt
2010-07-16 13:37 ` [patch 03/10] zfcp: Use correct width for timer_interval field Christof Schmitt
2010-07-16 13:37 ` [patch 04/10] zfcp: Cleanup function parameters for sbal value Christof Schmitt
2010-07-16 13:37 ` [patch 05/10] zfcp: Cleanup QDIO attachment and improve processing Christof Schmitt
2010-07-16 13:37 ` [patch 06/10] zfcp: Post events through FC transport class Christof Schmitt
2010-07-16 13:37 ` [patch 07/10] zfcp: Prevent access on uninitialized memory Christof Schmitt
2010-07-16 13:37 ` [patch 08/10] zfcp: Enable data division support for FCP devices Christof Schmitt
2010-07-16 13:37 ` [patch 09/10] zfcp: Introduce experimental support for DIF/DIX Christof Schmitt
2010-07-16 13:37 ` [patch 10/10] zfcp: Trigger logging in the FCP channel on qdio error conditions Christof Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100716134300.006377000@de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Bottomley@suse.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).