public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: linux-scsi@vger.kernel.org
Cc: Sven Schuetz <sven@linux.vnet.ibm.com>,
	James.Smart@Emulex.Com, Swen Schillig <swen@vnet.ibm.com>,
	Christof Schmitt <christof.schmitt@de.ibm.com>
Subject: [patch 1/2] zfcp: Set WKA-port to offline on adapter deactivation
Date: Mon, 06 Apr 2009 18:31:46 +0200	[thread overview]
Message-ID: <20090406163534.533486000@de.ibm.com> (raw)
In-Reply-To: 20090406163145.686874000@de.ibm.com

[-- Attachment #1: 704-zfcp-wka-port.diff --]
[-- Type: text/plain, Size: 4027 bytes --]

From: Swen Schillig <swen@vnet.ibm.com>

The nameserver port might be in state online when the adapter is
offlined. On adapter reactivation the nameserver port is not
re-opened due to the PORT_ONLINE status. This results in an
unsuccessful recovery. In forcing the nameserver port status 
to offline on all adapter offline events this issue is prevented.

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

 drivers/s390/scsi/zfcp_aux.c |    3 ++-
 drivers/s390/scsi/zfcp_ccw.c |    1 -
 drivers/s390/scsi/zfcp_erp.c |    1 +
 drivers/s390/scsi/zfcp_ext.h |    1 +
 drivers/s390/scsi/zfcp_fc.c  |   16 ++++++++++------
 5 files changed, 14 insertions(+), 8 deletions(-)

--- a/drivers/s390/scsi/zfcp_aux.c	2009-04-06 17:20:50.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_aux.c	2009-04-06 17:22:14.000000000 +0200
@@ -525,6 +525,8 @@ int zfcp_adapter_enqueue(struct ccw_devi
 
 	atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status);
 
+	zfcp_fc_nameserver_init(adapter);
+
 	if (!zfcp_adapter_scsi_register(adapter))
 		return 0;
 
@@ -553,7 +555,6 @@ void zfcp_adapter_dequeue(struct zfcp_ad
 
 	cancel_work_sync(&adapter->scan_work);
 	cancel_work_sync(&adapter->stat_work);
-	cancel_delayed_work_sync(&adapter->nsp.work);
 	zfcp_adapter_scsi_unregister(adapter);
 	sysfs_remove_group(&adapter->ccw_device->dev.kobj,
 			   &zfcp_sysfs_adapter_attrs);
--- a/drivers/s390/scsi/zfcp_ccw.c	2009-04-06 17:20:50.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_ccw.c	2009-04-06 17:22:14.000000000 +0200
@@ -108,7 +108,6 @@ static int zfcp_ccw_set_online(struct cc
 	/* initialize request counter */
 	BUG_ON(!zfcp_reqlist_isempty(adapter));
 	adapter->req_no = 0;
-	zfcp_fc_nameserver_init(adapter);
 
 	zfcp_erp_modify_adapter_status(adapter, "ccsonl1", NULL,
 				       ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
--- a/drivers/s390/scsi/zfcp_erp.c	2009-04-06 17:07:10.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_erp.c	2009-04-06 17:22:14.000000000 +0200
@@ -719,6 +719,7 @@ static void zfcp_erp_adapter_strategy_cl
 	zfcp_qdio_close(adapter);
 	zfcp_fsf_req_dismiss_all(adapter);
 	adapter->fsf_req_seq_no = 0;
+	zfcp_fc_wka_port_force_offline(&adapter->nsp);
 	/* all ports and units are closed */
 	zfcp_erp_modify_adapter_status(adapter, "erascl1", NULL,
 				       ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);
--- a/drivers/s390/scsi/zfcp_ext.h	2009-04-06 17:20:50.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_ext.h	2009-04-06 17:22:14.000000000 +0200
@@ -106,6 +106,7 @@ extern void zfcp_fc_plogi_evaluate(struc
 extern void zfcp_test_link(struct zfcp_port *);
 extern void zfcp_fc_link_test_work(struct work_struct *);
 extern void zfcp_fc_nameserver_init(struct zfcp_adapter *);
+extern void zfcp_fc_wka_port_force_offline(struct zfcp_wka_port *);
 
 /* zfcp_fsf.c */
 extern int zfcp_fsf_open_port(struct zfcp_erp_action *);
--- a/drivers/s390/scsi/zfcp_fc.c	2009-04-06 17:20:50.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_fc.c	2009-04-06 17:22:14.000000000 +0200
@@ -98,12 +98,8 @@ static void zfcp_wka_port_offline(struct
 	struct zfcp_wka_port *wka_port =
 			container_of(dw, struct zfcp_wka_port, work);
 
-	/* Don't wait forvever. If the wka_port is too busy take it offline
-	   through a new call later */
-	if (!wait_event_timeout(wka_port->completion_wq,
-				atomic_read(&wka_port->refcount) == 0,
-				HZ >> 1))
-		return;
+	wait_event(wka_port->completion_wq,
+		   atomic_read(&wka_port->refcount) == 0);
 
 	mutex_lock(&wka_port->mutex);
 	if ((atomic_read(&wka_port->refcount) != 0) ||
@@ -142,6 +138,14 @@ void zfcp_fc_nameserver_init(struct zfcp
 	INIT_DELAYED_WORK(&wka_port->work, zfcp_wka_port_offline);
 }
 
+void zfcp_fc_wka_port_force_offline(struct zfcp_wka_port *wka)
+{
+	cancel_delayed_work_sync(&wka->work);
+	mutex_lock(&wka->mutex);
+	wka->status = ZFCP_WKA_PORT_OFFLINE;
+	mutex_unlock(&wka->mutex);
+}
+
 static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
 				   struct fcp_rscn_element *elem)
 {


  reply	other threads:[~2009-04-06 16:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-06 16:31 [patch 0/2] FC pass-through support for zfcp Christof Schmitt
2009-04-06 16:31 ` Christof Schmitt [this message]
2009-04-06 16:31 ` [patch 2/2] zfcp: Add FC pass-through support Christof Schmitt
2009-04-07 23:17   ` James Smart
2009-04-08  7:39     ` Christof Schmitt
2009-04-08 11:29   ` Heiko Carstens
2009-04-08 11:38     ` 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=20090406163534.533486000@de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Smart@Emulex.Com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sven@linux.vnet.ibm.com \
    --cc=swen@vnet.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