linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window
@ 2013-08-21 15:05 Steffen Maier
  2013-08-21 15:05 ` [PATCH 1/8] zfcp: consistently use appropriate SBAL flag definitions Steffen Maier
                   ` (8 more replies)
  0 siblings, 9 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-21 15:05 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier

James,

here is a series of zfcp features and bugfixes
for the upcoming merge window preparing kernel v3.12.
The patches apply on top of the current misc branch of your scsi.git.

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/8] zfcp: consistently use appropriate SBAL flag definitions
  2013-08-21 15:05 [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window Steffen Maier
@ 2013-08-21 15:05 ` Steffen Maier
  2013-08-21 15:05 ` [PATCH 2/8] zfcp: cleanup use of obsolete strict_strto* functions Steffen Maier
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-21 15:05 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

minor cleanup for status read request

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_fsf.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -770,7 +770,8 @@ int zfcp_fsf_status_read(struct zfcp_qdi
 	if (zfcp_qdio_sbal_get(qdio))
 		goto out;
 
-	req = zfcp_fsf_req_create(qdio, FSF_QTCB_UNSOLICITED_STATUS, 0,
+	req = zfcp_fsf_req_create(qdio, FSF_QTCB_UNSOLICITED_STATUS,
+				  SBAL_SFLAGS0_TYPE_STATUS,
 				  adapter->pool.status_read_req);
 	if (IS_ERR(req)) {
 		retval = PTR_ERR(req);

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 2/8] zfcp: cleanup use of obsolete strict_strto* functions
  2013-08-21 15:05 [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window Steffen Maier
  2013-08-21 15:05 ` [PATCH 1/8] zfcp: consistently use appropriate SBAL flag definitions Steffen Maier
@ 2013-08-21 15:05 ` Steffen Maier
  2013-08-22  0:08   ` Jingoo Han
  2013-08-21 15:05 ` [PATCH 3/8] zfcp: dead code removal Steffen Maier
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Steffen Maier @ 2013-08-21 15:05 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke, Jingoo Han

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

strict_strtoul and friends are obsolete. Use kstrtoul functions
instead.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_aux.c   |    4 ++--
 drivers/s390/scsi/zfcp_sysfs.c |   12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -104,11 +104,11 @@ static void __init zfcp_init_device_setu
 	strncpy(busid, token, ZFCP_BUS_ID_SIZE);
 
 	token = strsep(&str, ",");
-	if (!token || strict_strtoull(token, 0, (unsigned long long *) &wwpn))
+	if (!token || kstrtoull(token, 0, (unsigned long long *) &wwpn))
 		goto err_out;
 
 	token = strsep(&str, ",");
-	if (!token || strict_strtoull(token, 0, (unsigned long long *) &lun))
+	if (!token || kstrtoull(token, 0, (unsigned long long *) &lun))
 		goto err_out;
 
 	kfree(str_saved);
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -95,7 +95,7 @@ static ssize_t zfcp_sysfs_port_failed_st
 	struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
 	unsigned long val;
 
-	if (strict_strtoul(buf, 0, &val) || val != 0)
+	if (kstrtoul(buf, 0, &val) || val != 0)
 		return -EINVAL;
 
 	zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_RUNNING);
@@ -134,7 +134,7 @@ static ssize_t zfcp_sysfs_unit_failed_st
 	unsigned long val;
 	struct scsi_device *sdev;
 
-	if (strict_strtoul(buf, 0, &val) || val != 0)
+	if (kstrtoul(buf, 0, &val) || val != 0)
 		return -EINVAL;
 
 	sdev = zfcp_unit_sdev(unit);
@@ -184,7 +184,7 @@ static ssize_t zfcp_sysfs_adapter_failed
 	if (!adapter)
 		return -ENODEV;
 
-	if (strict_strtoul(buf, 0, &val) || val != 0) {
+	if (kstrtoul(buf, 0, &val) || val != 0) {
 		retval = -EINVAL;
 		goto out;
 	}
@@ -236,7 +236,7 @@ static ssize_t zfcp_sysfs_port_remove_st
 	if (!adapter)
 		return -ENODEV;
 
-	if (strict_strtoull(buf, 0, (unsigned long long *) &wwpn))
+	if (kstrtoull(buf, 0, (unsigned long long *) &wwpn))
 		goto out;
 
 	port = zfcp_get_port_by_wwpn(adapter, wwpn);
@@ -297,7 +297,7 @@ static ssize_t zfcp_sysfs_unit_add_store
 	u64 fcp_lun;
 	int retval;
 
-	if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
+	if (kstrtoull(buf, 0, (unsigned long long *) &fcp_lun))
 		return -EINVAL;
 
 	retval = zfcp_unit_add(port, fcp_lun);
@@ -315,7 +315,7 @@ static ssize_t zfcp_sysfs_unit_remove_st
 	struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
 	u64 fcp_lun;
 
-	if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
+	if (kstrtoull(buf, 0, (unsigned long long *) &fcp_lun))
 		return -EINVAL;
 
 	if (zfcp_unit_remove(port, fcp_lun))

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 3/8] zfcp: dead code removal
  2013-08-21 15:05 [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window Steffen Maier
  2013-08-21 15:05 ` [PATCH 1/8] zfcp: consistently use appropriate SBAL flag definitions Steffen Maier
  2013-08-21 15:05 ` [PATCH 2/8] zfcp: cleanup use of obsolete strict_strto* functions Steffen Maier
@ 2013-08-21 15:05 ` Steffen Maier
  2013-08-21 15:05 ` [PATCH 4/8] zfcp: fix lock imbalance by reworking request queue locking Steffen Maier
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-21 15:05 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

Get rid of unused function zfcp_fsf_get_req and corresponding
prototype definition.

Commit a54ca0f62f953898b05549391ac2a8a4dad6482b in v2.6.28
"[SCSI] zfcp: Redesign of the debug tracing for HBA records."
accidentally introduced this code which was dead in the first place.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_ext.h |    2 --
 drivers/s390/scsi/zfcp_fsf.c |    9 ---------
 2 files changed, 11 deletions(-)

--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -126,8 +126,6 @@ extern int zfcp_qdio_sbals_from_sg(struc
 extern int zfcp_qdio_open(struct zfcp_qdio *);
 extern void zfcp_qdio_close(struct zfcp_qdio *);
 extern void zfcp_qdio_siosl(struct zfcp_adapter *);
-extern struct zfcp_fsf_req *zfcp_fsf_get_req(struct zfcp_qdio *,
-					     struct qdio_buffer *);
 
 /* zfcp_scsi.c */
 extern struct scsi_transport_template *zfcp_scsi_transport_template;
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2388,12 +2388,3 @@ void zfcp_fsf_reqid_check(struct zfcp_qd
 			break;
 	}
 }
-
-struct zfcp_fsf_req *zfcp_fsf_get_req(struct zfcp_qdio *qdio,
-				      struct qdio_buffer *sbal)
-{
-	struct qdio_buffer_element *sbale = &sbal->element[0];
-	u64 req_id = (unsigned long) sbale->addr;
-
-	return zfcp_reqlist_find(qdio->adapter->req_list, req_id);
-}

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 4/8] zfcp: fix lock imbalance by reworking request queue locking
  2013-08-21 15:05 [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window Steffen Maier
                   ` (2 preceding siblings ...)
  2013-08-21 15:05 ` [PATCH 3/8] zfcp: dead code removal Steffen Maier
@ 2013-08-21 15:05 ` Steffen Maier
  2013-08-21 15:05 ` [PATCH 5/8] zfcp: fix schedule-inside-lock in scsi_device list loops Steffen Maier
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-21 15:05 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke, stable, Andrew Morton,
	David Howells, Jens Axboe, Paul E. McKenney, Daniel Vetter,
	linux-kernel

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

This patch adds wait_event_interruptible_lock_irq_timeout(), which is a
straight-forward descendant of wait_event_interruptible_timeout() and
wait_event_interruptible_lock_irq().

The zfcp driver used to call wait_event_interruptible_timeout()
in combination with some intricate and error-prone locking. Using
wait_event_interruptible_lock_irq_timeout() as a replacement
nicely cleans up that locking.

This rework removes a situation that resulted in a locking imbalance
in zfcp_qdio_sbal_get():

BUG: workqueue leaked lock or atomic: events/1/0xffffff00/10
    last function: zfcp_fc_wka_port_offline+0x0/0xa0 [zfcp]

It was introduced by commit c2af7545aaff3495d9bf9a7608c52f0af86fb194
"[SCSI] zfcp: Do not wait for SBALs on stopped queue", which had a new
code path related to ZFCP_STATUS_ADAPTER_QDIOUP that took an early exit
without a required lock being held. The problem occured when a
special, non-SCSI I/O request was being submitted in process context,
when the adapter's queues had been torn down. In this case the bug
surfaced when the Fibre Channel port connection for a well-known address
was closed during a concurrent adapter shut-down procedure, which is a
rare constellation.

This patch also fixes these warnings from the sparse tool (make C=1):

drivers/s390/scsi/zfcp_qdio.c:224:12: warning: context imbalance in
 'zfcp_qdio_sbal_check' - wrong count at exit
drivers/s390/scsi/zfcp_qdio.c:244:5: warning: context imbalance in
 'zfcp_qdio_sbal_get' - unexpected unlock

Last but not least, we get rid of that crappy lock-unlock-lock
sequence at the beginning of the critical section.

It is okay to call zfcp_erp_adapter_reopen() with req_q_lock held.

Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org #2.6.35+
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_qdio.c |    8 +----
 include/linux/wait.h          |   57 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 6 deletions(-)

--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -224,11 +224,9 @@ int zfcp_qdio_sbals_from_sg(struct zfcp_
 
 static int zfcp_qdio_sbal_check(struct zfcp_qdio *qdio)
 {
-	spin_lock_irq(&qdio->req_q_lock);
 	if (atomic_read(&qdio->req_q_free) ||
 	    !(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP))
 		return 1;
-	spin_unlock_irq(&qdio->req_q_lock);
 	return 0;
 }
 
@@ -246,9 +244,8 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio
 {
 	long ret;
 
-	spin_unlock_irq(&qdio->req_q_lock);
-	ret = wait_event_interruptible_timeout(qdio->req_q_wq,
-			       zfcp_qdio_sbal_check(qdio), 5 * HZ);
+	ret = wait_event_interruptible_lock_irq_timeout(qdio->req_q_wq,
+		       zfcp_qdio_sbal_check(qdio), qdio->req_q_lock, 5 * HZ);
 
 	if (!(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP))
 		return -EIO;
@@ -262,7 +259,6 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio
 		zfcp_erp_adapter_reopen(qdio->adapter, 0, "qdsbg_1");
 	}
 
-	spin_lock_irq(&qdio->req_q_lock);
 	return -EIO;
 }
 
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -811,6 +811,63 @@ do {									\
 	__ret;								\
 })
 
+#define __wait_event_interruptible_lock_irq_timeout(wq, condition,	\
+						    lock, ret)		\
+do {									\
+	DEFINE_WAIT(__wait);						\
+									\
+	for (;;) {							\
+		prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE);	\
+		if (condition)						\
+			break;						\
+		if (signal_pending(current)) {				\
+			ret = -ERESTARTSYS;				\
+			break;						\
+		}							\
+		spin_unlock_irq(&lock);					\
+		ret = schedule_timeout(ret);				\
+		spin_lock_irq(&lock);					\
+		if (!ret)						\
+			break;						\
+	}								\
+	finish_wait(&wq, &__wait);					\
+} while (0)
+
+/**
+ * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets true or a timeout elapses.
+ *		The condition is checked under the lock. This is expected
+ *		to be called with the lock taken.
+ * @wq: the waitqueue to wait on
+ * @condition: a C expression for the event to wait for
+ * @lock: a locked spinlock_t, which will be released before schedule()
+ *	  and reacquired afterwards.
+ * @timeout: timeout, in jiffies
+ *
+ * The process is put to sleep (TASK_INTERRUPTIBLE) until the
+ * @condition evaluates to true or signal is received. The @condition is
+ * checked each time the waitqueue @wq is woken up.
+ *
+ * wake_up() has to be called after changing any variable that could
+ * change the result of the wait condition.
+ *
+ * This is supposed to be called while holding the lock. The lock is
+ * dropped before going to sleep and is reacquired afterwards.
+ *
+ * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it
+ * was interrupted by a signal, and the remaining jiffies otherwise
+ * if the condition evaluated to true before the timeout elapsed.
+ */
+#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock,	\
+						  timeout)		\
+({									\
+	int __ret = timeout;						\
+									\
+	if (!(condition))						\
+		__wait_event_interruptible_lock_irq_timeout(		\
+					wq, condition, lock, __ret);	\
+	__ret;								\
+})
+
 
 /*
  * These are the old interfaces to sleep waiting for an event.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 5/8] zfcp: fix schedule-inside-lock in scsi_device list loops
  2013-08-21 15:05 [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window Steffen Maier
                   ` (3 preceding siblings ...)
  2013-08-21 15:05 ` [PATCH 4/8] zfcp: fix lock imbalance by reworking request queue locking Steffen Maier
@ 2013-08-21 15:05 ` Steffen Maier
  2013-08-21 15:05 ` [PATCH 6/8] zfcp: remove access control tables interface (keep sysfs files) Steffen Maier
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-21 15:05 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke, stable

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

BUG: sleeping function called from invalid context at kernel/workqueue.c:2752
in_atomic(): 1, irqs_disabled(): 1, pid: 360, name: zfcperp0.0.1700
CPU: 1 Not tainted 3.9.3+ #69
Process zfcperp0.0.1700 (pid: 360, task: 0000000075b7e080, ksp: 000000007476bc30)
<snip>
Call Trace:
([<00000000001165de>] show_trace+0x106/0x154)
 [<00000000001166a0>] show_stack+0x74/0xf4
 [<00000000006ff646>] dump_stack+0xc6/0xd4
 [<000000000017f3a0>] __might_sleep+0x128/0x148
 [<000000000015ece8>] flush_work+0x54/0x1f8
 [<00000000001630de>] __cancel_work_timer+0xc6/0x128
 [<00000000005067ac>] scsi_device_dev_release_usercontext+0x164/0x23c
 [<0000000000161816>] execute_in_process_context+0x96/0xa8
 [<00000000004d33d8>] device_release+0x60/0xc0
 [<000000000048af48>] kobject_release+0xa8/0x1c4
 [<00000000004f4bf2>] __scsi_iterate_devices+0xfa/0x130
 [<000003ff801b307a>] zfcp_erp_strategy+0x4da/0x1014 [zfcp]
 [<000003ff801b3caa>] zfcp_erp_thread+0xf6/0x2b0 [zfcp]
 [<000000000016b75a>] kthread+0xf2/0xfc
 [<000000000070c9de>] kernel_thread_starter+0x6/0xc
 [<000000000070c9d8>] kernel_thread_starter+0x0/0xc

Apparently, the ref_count for some scsi_device drops down to zero,
triggering device removal through execute_in_process_context(), while
the lldd error recovery thread iterates through a scsi device list.
Unfortunately, execute_in_process_context() decides to immediately
execute that device removal function, instead of scheduling asynchronous
execution, since it detects process context and thinks it is safe to do
so. But almost all calls to shost_for_each_device() in our lldd are
inside spin_lock_irq, even in thread context. Obviously, schedule()
inside spin_lock_irq sections is a bad idea.

Change the lldd to use the proper iterator function,
__shost_for_each_device(), in combination with required locking.

Occurences that need to be changed include all calls in zfcp_erp.c,
since those might be executed in zfcp error recovery thread context
with a lock held.

Other occurences of shost_for_each_device() in zfcp_fsf.c do not
need to be changed (no process context, no surrounding locking).

The problem was introduced in Linux 2.6.37 by commit
b62a8d9b45b971a67a0f8413338c230e3117dff5
"[SCSI] zfcp: Use SCSI device data zfcp_scsi_dev instead of zfcp_unit".

Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org #2.6.37+
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_erp.c |   29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -102,10 +102,13 @@ static void zfcp_erp_action_dismiss_port
 
 	if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_INUSE)
 		zfcp_erp_action_dismiss(&port->erp_action);
-	else
-		shost_for_each_device(sdev, port->adapter->scsi_host)
+	else {
+		spin_lock(port->adapter->scsi_host->host_lock);
+		__shost_for_each_device(sdev, port->adapter->scsi_host)
 			if (sdev_to_zfcp(sdev)->port == port)
 				zfcp_erp_action_dismiss_lun(sdev);
+		spin_unlock(port->adapter->scsi_host->host_lock);
+	}
 }
 
 static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)
@@ -592,9 +595,11 @@ static void _zfcp_erp_lun_reopen_all(str
 {
 	struct scsi_device *sdev;
 
-	shost_for_each_device(sdev, port->adapter->scsi_host)
+	spin_lock(port->adapter->scsi_host->host_lock);
+	__shost_for_each_device(sdev, port->adapter->scsi_host)
 		if (sdev_to_zfcp(sdev)->port == port)
 			_zfcp_erp_lun_reopen(sdev, clear, id, 0);
+	spin_unlock(port->adapter->scsi_host->host_lock);
 }
 
 static void zfcp_erp_strategy_followup_failed(struct zfcp_erp_action *act)
@@ -1434,8 +1439,10 @@ void zfcp_erp_set_adapter_status(struct
 		atomic_set_mask(common_mask, &port->status);
 	read_unlock_irqrestore(&adapter->port_list_lock, flags);
 
-	shost_for_each_device(sdev, adapter->scsi_host)
+	spin_lock_irqsave(adapter->scsi_host->host_lock, flags);
+	__shost_for_each_device(sdev, adapter->scsi_host)
 		atomic_set_mask(common_mask, &sdev_to_zfcp(sdev)->status);
+	spin_unlock_irqrestore(adapter->scsi_host->host_lock, flags);
 }
 
 /**
@@ -1469,11 +1476,13 @@ void zfcp_erp_clear_adapter_status(struc
 	}
 	read_unlock_irqrestore(&adapter->port_list_lock, flags);
 
-	shost_for_each_device(sdev, adapter->scsi_host) {
+	spin_lock_irqsave(adapter->scsi_host->host_lock, flags);
+	__shost_for_each_device(sdev, adapter->scsi_host) {
 		atomic_clear_mask(common_mask, &sdev_to_zfcp(sdev)->status);
 		if (clear_counter)
 			atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
 	}
+	spin_unlock_irqrestore(adapter->scsi_host->host_lock, flags);
 }
 
 /**
@@ -1487,16 +1496,19 @@ void zfcp_erp_set_port_status(struct zfc
 {
 	struct scsi_device *sdev;
 	u32 common_mask = mask & ZFCP_COMMON_FLAGS;
+	unsigned long flags;
 
 	atomic_set_mask(mask, &port->status);
 
 	if (!common_mask)
 		return;
 
-	shost_for_each_device(sdev, port->adapter->scsi_host)
+	spin_lock_irqsave(port->adapter->scsi_host->host_lock, flags);
+	__shost_for_each_device(sdev, port->adapter->scsi_host)
 		if (sdev_to_zfcp(sdev)->port == port)
 			atomic_set_mask(common_mask,
 					&sdev_to_zfcp(sdev)->status);
+	spin_unlock_irqrestore(port->adapter->scsi_host->host_lock, flags);
 }
 
 /**
@@ -1511,6 +1523,7 @@ void zfcp_erp_clear_port_status(struct z
 	struct scsi_device *sdev;
 	u32 common_mask = mask & ZFCP_COMMON_FLAGS;
 	u32 clear_counter = mask & ZFCP_STATUS_COMMON_ERP_FAILED;
+	unsigned long flags;
 
 	atomic_clear_mask(mask, &port->status);
 
@@ -1520,13 +1533,15 @@ void zfcp_erp_clear_port_status(struct z
 	if (clear_counter)
 		atomic_set(&port->erp_counter, 0);
 
-	shost_for_each_device(sdev, port->adapter->scsi_host)
+	spin_lock_irqsave(port->adapter->scsi_host->host_lock, flags);
+	__shost_for_each_device(sdev, port->adapter->scsi_host)
 		if (sdev_to_zfcp(sdev)->port == port) {
 			atomic_clear_mask(common_mask,
 					  &sdev_to_zfcp(sdev)->status);
 			if (clear_counter)
 				atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
 		}
+	spin_unlock_irqrestore(port->adapter->scsi_host->host_lock, flags);
 }
 
 /**

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 6/8] zfcp: remove access control tables interface (keep sysfs files)
  2013-08-21 15:05 [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window Steffen Maier
                   ` (4 preceding siblings ...)
  2013-08-21 15:05 ` [PATCH 5/8] zfcp: fix schedule-inside-lock in scsi_device list loops Steffen Maier
@ 2013-08-21 15:05 ` Steffen Maier
  2013-08-21 15:05 ` [PATCH 7/8] zfcp: remove access control tables interface (port leftovers) Steffen Maier
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-21 15:05 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke, stable

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

By popular demand, this patch brings back a couple of sysfs attributes
removed by commit 663e0890e31cb85f0cca5ac1faaee0d2d52880b5
"[SCSI] zfcp: remove access control tables interface".
The content has been irrelevant for years, but the files must be
there forever for whatever user space tools that may rely on them.

Since these files always return a constant value, a new stripped
down show-macro was required. Otherwise build warnings would have
been introduced.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org #3.11+
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_sysfs.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -27,6 +27,16 @@ static ssize_t zfcp_sysfs_##_feat##_##_n
 static ZFCP_DEV_ATTR(_feat, _name, S_IRUGO,				       \
 		     zfcp_sysfs_##_feat##_##_name##_show, NULL);
 
+#define ZFCP_DEFINE_ATTR_CONST(_feat, _name, _format, _value)		       \
+static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev,	       \
+						   struct device_attribute *at,\
+						   char *buf)		       \
+{									       \
+	return sprintf(buf, _format, _value);				       \
+}									       \
+static ZFCP_DEV_ATTR(_feat, _name, S_IRUGO,				       \
+		     zfcp_sysfs_##_feat##_##_name##_show, NULL);
+
 #define ZFCP_DEFINE_A_ATTR(_name, _format, _value)			     \
 static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev,	     \
 						 struct device_attribute *at,\
@@ -75,6 +85,8 @@ ZFCP_DEFINE_ATTR(zfcp_unit, unit, in_rec
 ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_denied, "%d\n",
 		 (zfcp_unit_sdev_status(unit) &
 		  ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0);
+ZFCP_DEFINE_ATTR_CONST(unit, access_shared, "%d\n", 0);
+ZFCP_DEFINE_ATTR_CONST(unit, access_readonly, "%d\n", 0);
 
 static ssize_t zfcp_sysfs_port_failed_show(struct device *dev,
 					   struct device_attribute *attr,
@@ -347,6 +359,8 @@ static struct attribute *zfcp_unit_attrs
 	&dev_attr_unit_in_recovery.attr,
 	&dev_attr_unit_status.attr,
 	&dev_attr_unit_access_denied.attr,
+	&dev_attr_unit_access_shared.attr,
+	&dev_attr_unit_access_readonly.attr,
 	NULL
 };
 static struct attribute_group zfcp_unit_attr_group = {

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 7/8] zfcp: remove access control tables interface (port leftovers)
  2013-08-21 15:05 [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window Steffen Maier
                   ` (5 preceding siblings ...)
  2013-08-21 15:05 ` [PATCH 6/8] zfcp: remove access control tables interface (keep sysfs files) Steffen Maier
@ 2013-08-21 15:05 ` Steffen Maier
  2013-08-21 15:05 ` [PATCH 8/8] zfcp: enable FCP hardware data router by default Steffen Maier
  2013-08-21 15:36 ` [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window James Bottomley
  8 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-21 15:05 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

This patch removes some leftovers for commit
663e0890e31cb85f0cca5ac1faaee0d2d52880b5
"[SCSI] zfcp: remove access control tables interface".

The "access denied" case for ports is gone, as well.
The corresponding flag was cleared, but never set.
So clean it up.

Sysfs flag is kept, though, for backward-compatibility.
Now it returns always 0.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_erp.c   |    7 -------
 drivers/s390/scsi/zfcp_fsf.c   |    3 +--
 drivers/s390/scsi/zfcp_sysfs.c |    4 +---
 3 files changed, 2 insertions(+), 12 deletions(-)

--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -821,11 +821,6 @@ static int zfcp_erp_port_forced_strategy
 	return ZFCP_ERP_CONTINUES;
 }
 
-static void zfcp_erp_port_strategy_clearstati(struct zfcp_port *port)
-{
-	atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, &port->status);
-}
-
 static int zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action)
 {
 	struct zfcp_port *port = erp_action->port;
@@ -833,7 +828,6 @@ static int zfcp_erp_port_forced_strategy
 
 	switch (erp_action->step) {
 	case ZFCP_ERP_STEP_UNINITIALIZED:
-		zfcp_erp_port_strategy_clearstati(port);
 		if ((status & ZFCP_STATUS_PORT_PHYS_OPEN) &&
 		    (status & ZFCP_STATUS_COMMON_OPEN))
 			return zfcp_erp_port_forced_strategy_close(erp_action);
@@ -933,7 +927,6 @@ static int zfcp_erp_port_strategy(struct
 
 	switch (erp_action->step) {
 	case ZFCP_ERP_STEP_UNINITIALIZED:
-		zfcp_erp_port_strategy_clearstati(port);
 		if (p_status & ZFCP_STATUS_COMMON_OPEN)
 			return zfcp_erp_port_strategy_close(erp_action);
 		break;
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -1396,8 +1396,7 @@ static void zfcp_fsf_open_port_handler(s
 		port->handle = header->port_handle;
 		atomic_set_mask(ZFCP_STATUS_COMMON_OPEN |
 				ZFCP_STATUS_PORT_PHYS_OPEN, &port->status);
-		atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |
-		                  ZFCP_STATUS_COMMON_ACCESS_BOXED,
+		atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED,
 		                  &port->status);
 		/* check whether D_ID has changed during open */
 		/*
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -73,9 +73,7 @@ ZFCP_DEFINE_ATTR(zfcp_port, port, status
 ZFCP_DEFINE_ATTR(zfcp_port, port, in_recovery, "%d\n",
 		 (atomic_read(&port->status) &
 		  ZFCP_STATUS_COMMON_ERP_INUSE) != 0);
-ZFCP_DEFINE_ATTR(zfcp_port, port, access_denied, "%d\n",
-		 (atomic_read(&port->status) &
-		  ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0);
+ZFCP_DEFINE_ATTR_CONST(port, access_denied, "%d\n", 0);
 
 ZFCP_DEFINE_ATTR(zfcp_unit, unit, status, "0x%08x\n",
 		 zfcp_unit_sdev_status(unit));

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 8/8] zfcp: enable FCP hardware data router by default
  2013-08-21 15:05 [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window Steffen Maier
                   ` (6 preceding siblings ...)
  2013-08-21 15:05 ` [PATCH 7/8] zfcp: remove access control tables interface (port leftovers) Steffen Maier
@ 2013-08-21 15:05 ` Steffen Maier
  2013-08-21 15:36 ` [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window James Bottomley
  8 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-21 15:05 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier

Enabling the data router support by default
can increase performance in certain situations.
It is safe to do so and tolerated in LPAR and under z/VM
in case there is no data router support in that environment.

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Reviewed-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_qdio.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -16,9 +16,9 @@
 
 #define QBUFF_PER_PAGE		(PAGE_SIZE / sizeof(struct qdio_buffer))
 
-static bool enable_multibuffer;
+static bool enable_multibuffer = 1;
 module_param_named(datarouter, enable_multibuffer, bool, 0400);
-MODULE_PARM_DESC(datarouter, "Enable hardware data router support");
+MODULE_PARM_DESC(datarouter, "Enable hardware data router support (default on)");
 
 static int zfcp_qdio_buffers_enqueue(struct qdio_buffer **sbal)
 {

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window
  2013-08-21 15:05 [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window Steffen Maier
                   ` (7 preceding siblings ...)
  2013-08-21 15:05 ` [PATCH 8/8] zfcp: enable FCP hardware data router by default Steffen Maier
@ 2013-08-21 15:36 ` James Bottomley
  2013-08-22 15:45   ` [PATCH RESEND 0/3] zfcp bugfixes for 3.11-rc Steffen Maier
  2013-08-22 15:49   ` [PATCH RESEND 0/4] zfcp features for 3.12 merge window Steffen Maier
  8 siblings, 2 replies; 22+ messages in thread
From: James Bottomley @ 2013-08-21 15:36 UTC (permalink / raw)
  To: Steffen Maier; +Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens

On Wed, 2013-08-21 at 17:05 +0200, Steffen Maier wrote:
> James,
> 
> here is a series of zfcp features and bugfixes
> for the upcoming merge window preparing kernel v3.12.
> The patches apply on top of the current misc branch of your scsi.git.

OK, so this isn't going to work any more given Greg's recent statements.
Patches for stable have to go through the -rc fixes process, so could
you redo this as two patch sets: one for fixes with the cc stable tags
and the rest for misc?

Thanks,

James

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/8] zfcp: cleanup use of obsolete strict_strto* functions
  2013-08-21 15:05 ` [PATCH 2/8] zfcp: cleanup use of obsolete strict_strto* functions Steffen Maier
@ 2013-08-22  0:08   ` Jingoo Han
  0 siblings, 0 replies; 22+ messages in thread
From: Jingoo Han @ 2013-08-22  0:08 UTC (permalink / raw)
  To: 'Steffen Maier', 'James Bottomley'
  Cc: linux-scsi, linux-s390, 'Martin Schwidefsky',
	'Heiko Carstens', 'Martin Peschke',
	'Jingoo Han'

On Thursday, August 22, 2013 12:05 AM, Steffen Maier wrote:
> 
> From: Martin Peschke <mpeschke@linux.vnet.ibm.com>
> 
> strict_strtoul and friends are obsolete. Use kstrtoul functions
> instead.
> 
> Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
> Cc: Jingoo Han <jg1.han@samsung.com>

Reviewed-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
> ---
>  drivers/s390/scsi/zfcp_aux.c   |    4 ++--
>  drivers/s390/scsi/zfcp_sysfs.c |   12 ++++++------
>  2 files changed, 8 insertions(+), 8 deletions(-)

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH RESEND 0/3] zfcp bugfixes for 3.11-rc
  2013-08-21 15:36 ` [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window James Bottomley
@ 2013-08-22 15:45   ` Steffen Maier
  2013-08-22 15:45     ` [PATCH RESEND 1/3] zfcp: fix lock imbalance by reworking request queue locking Steffen Maier
                       ` (2 more replies)
  2013-08-22 15:49   ` [PATCH RESEND 0/4] zfcp features for 3.12 merge window Steffen Maier
  1 sibling, 3 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-22 15:45 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier

James,

as discussed, I split up bugfixes and features in two separate sets.
Here is a resend of zfcp bugfixes for 3.11-rc and stable.
The patches apply on top of the current fixes branch of your scsi.git.

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH RESEND 1/3] zfcp: fix lock imbalance by reworking request queue locking
  2013-08-22 15:45   ` [PATCH RESEND 0/3] zfcp bugfixes for 3.11-rc Steffen Maier
@ 2013-08-22 15:45     ` Steffen Maier
  2013-08-22 15:45     ` [PATCH RESEND 2/3] zfcp: fix schedule-inside-lock in scsi_device list loops Steffen Maier
  2013-08-22 15:45     ` [PATCH RESEND 3/3] zfcp: remove access control tables interface (keep sysfs files) Steffen Maier
  2 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-22 15:45 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke, stable, Andrew Morton,
	David Howells, Jens Axboe, Paul E. McKenney, Daniel Vetter,
	linux-kernel

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

This patch adds wait_event_interruptible_lock_irq_timeout(), which is a
straight-forward descendant of wait_event_interruptible_timeout() and
wait_event_interruptible_lock_irq().

The zfcp driver used to call wait_event_interruptible_timeout()
in combination with some intricate and error-prone locking. Using
wait_event_interruptible_lock_irq_timeout() as a replacement
nicely cleans up that locking.

This rework removes a situation that resulted in a locking imbalance
in zfcp_qdio_sbal_get():

BUG: workqueue leaked lock or atomic: events/1/0xffffff00/10
    last function: zfcp_fc_wka_port_offline+0x0/0xa0 [zfcp]

It was introduced by commit c2af7545aaff3495d9bf9a7608c52f0af86fb194
"[SCSI] zfcp: Do not wait for SBALs on stopped queue", which had a new
code path related to ZFCP_STATUS_ADAPTER_QDIOUP that took an early exit
without a required lock being held. The problem occured when a
special, non-SCSI I/O request was being submitted in process context,
when the adapter's queues had been torn down. In this case the bug
surfaced when the Fibre Channel port connection for a well-known address
was closed during a concurrent adapter shut-down procedure, which is a
rare constellation.

This patch also fixes these warnings from the sparse tool (make C=1):

drivers/s390/scsi/zfcp_qdio.c:224:12: warning: context imbalance in
 'zfcp_qdio_sbal_check' - wrong count at exit
drivers/s390/scsi/zfcp_qdio.c:244:5: warning: context imbalance in
 'zfcp_qdio_sbal_get' - unexpected unlock

Last but not least, we get rid of that crappy lock-unlock-lock
sequence at the beginning of the critical section.

It is okay to call zfcp_erp_adapter_reopen() with req_q_lock held.

Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org #2.6.35+
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_qdio.c |    8 +----
 include/linux/wait.h          |   57 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 6 deletions(-)

--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -224,11 +224,9 @@ int zfcp_qdio_sbals_from_sg(struct zfcp_
 
 static int zfcp_qdio_sbal_check(struct zfcp_qdio *qdio)
 {
-	spin_lock_irq(&qdio->req_q_lock);
 	if (atomic_read(&qdio->req_q_free) ||
 	    !(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP))
 		return 1;
-	spin_unlock_irq(&qdio->req_q_lock);
 	return 0;
 }
 
@@ -246,9 +244,8 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio
 {
 	long ret;
 
-	spin_unlock_irq(&qdio->req_q_lock);
-	ret = wait_event_interruptible_timeout(qdio->req_q_wq,
-			       zfcp_qdio_sbal_check(qdio), 5 * HZ);
+	ret = wait_event_interruptible_lock_irq_timeout(qdio->req_q_wq,
+		       zfcp_qdio_sbal_check(qdio), qdio->req_q_lock, 5 * HZ);
 
 	if (!(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP))
 		return -EIO;
@@ -262,7 +259,6 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio
 		zfcp_erp_adapter_reopen(qdio->adapter, 0, "qdsbg_1");
 	}
 
-	spin_lock_irq(&qdio->req_q_lock);
 	return -EIO;
 }
 
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -811,6 +811,63 @@ do {									\
 	__ret;								\
 })
 
+#define __wait_event_interruptible_lock_irq_timeout(wq, condition,	\
+						    lock, ret)		\
+do {									\
+	DEFINE_WAIT(__wait);						\
+									\
+	for (;;) {							\
+		prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE);	\
+		if (condition)						\
+			break;						\
+		if (signal_pending(current)) {				\
+			ret = -ERESTARTSYS;				\
+			break;						\
+		}							\
+		spin_unlock_irq(&lock);					\
+		ret = schedule_timeout(ret);				\
+		spin_lock_irq(&lock);					\
+		if (!ret)						\
+			break;						\
+	}								\
+	finish_wait(&wq, &__wait);					\
+} while (0)
+
+/**
+ * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets true or a timeout elapses.
+ *		The condition is checked under the lock. This is expected
+ *		to be called with the lock taken.
+ * @wq: the waitqueue to wait on
+ * @condition: a C expression for the event to wait for
+ * @lock: a locked spinlock_t, which will be released before schedule()
+ *	  and reacquired afterwards.
+ * @timeout: timeout, in jiffies
+ *
+ * The process is put to sleep (TASK_INTERRUPTIBLE) until the
+ * @condition evaluates to true or signal is received. The @condition is
+ * checked each time the waitqueue @wq is woken up.
+ *
+ * wake_up() has to be called after changing any variable that could
+ * change the result of the wait condition.
+ *
+ * This is supposed to be called while holding the lock. The lock is
+ * dropped before going to sleep and is reacquired afterwards.
+ *
+ * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it
+ * was interrupted by a signal, and the remaining jiffies otherwise
+ * if the condition evaluated to true before the timeout elapsed.
+ */
+#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock,	\
+						  timeout)		\
+({									\
+	int __ret = timeout;						\
+									\
+	if (!(condition))						\
+		__wait_event_interruptible_lock_irq_timeout(		\
+					wq, condition, lock, __ret);	\
+	__ret;								\
+})
+
 
 /*
  * These are the old interfaces to sleep waiting for an event.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH RESEND 2/3] zfcp: fix schedule-inside-lock in scsi_device list loops
  2013-08-22 15:45   ` [PATCH RESEND 0/3] zfcp bugfixes for 3.11-rc Steffen Maier
  2013-08-22 15:45     ` [PATCH RESEND 1/3] zfcp: fix lock imbalance by reworking request queue locking Steffen Maier
@ 2013-08-22 15:45     ` Steffen Maier
  2013-08-22 15:45     ` [PATCH RESEND 3/3] zfcp: remove access control tables interface (keep sysfs files) Steffen Maier
  2 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-22 15:45 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke, stable

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

BUG: sleeping function called from invalid context at kernel/workqueue.c:2752
in_atomic(): 1, irqs_disabled(): 1, pid: 360, name: zfcperp0.0.1700
CPU: 1 Not tainted 3.9.3+ #69
Process zfcperp0.0.1700 (pid: 360, task: 0000000075b7e080, ksp: 000000007476bc30)
<snip>
Call Trace:
([<00000000001165de>] show_trace+0x106/0x154)
 [<00000000001166a0>] show_stack+0x74/0xf4
 [<00000000006ff646>] dump_stack+0xc6/0xd4
 [<000000000017f3a0>] __might_sleep+0x128/0x148
 [<000000000015ece8>] flush_work+0x54/0x1f8
 [<00000000001630de>] __cancel_work_timer+0xc6/0x128
 [<00000000005067ac>] scsi_device_dev_release_usercontext+0x164/0x23c
 [<0000000000161816>] execute_in_process_context+0x96/0xa8
 [<00000000004d33d8>] device_release+0x60/0xc0
 [<000000000048af48>] kobject_release+0xa8/0x1c4
 [<00000000004f4bf2>] __scsi_iterate_devices+0xfa/0x130
 [<000003ff801b307a>] zfcp_erp_strategy+0x4da/0x1014 [zfcp]
 [<000003ff801b3caa>] zfcp_erp_thread+0xf6/0x2b0 [zfcp]
 [<000000000016b75a>] kthread+0xf2/0xfc
 [<000000000070c9de>] kernel_thread_starter+0x6/0xc
 [<000000000070c9d8>] kernel_thread_starter+0x0/0xc

Apparently, the ref_count for some scsi_device drops down to zero,
triggering device removal through execute_in_process_context(), while
the lldd error recovery thread iterates through a scsi device list.
Unfortunately, execute_in_process_context() decides to immediately
execute that device removal function, instead of scheduling asynchronous
execution, since it detects process context and thinks it is safe to do
so. But almost all calls to shost_for_each_device() in our lldd are
inside spin_lock_irq, even in thread context. Obviously, schedule()
inside spin_lock_irq sections is a bad idea.

Change the lldd to use the proper iterator function,
__shost_for_each_device(), in combination with required locking.

Occurences that need to be changed include all calls in zfcp_erp.c,
since those might be executed in zfcp error recovery thread context
with a lock held.

Other occurences of shost_for_each_device() in zfcp_fsf.c do not
need to be changed (no process context, no surrounding locking).

The problem was introduced in Linux 2.6.37 by commit
b62a8d9b45b971a67a0f8413338c230e3117dff5
"[SCSI] zfcp: Use SCSI device data zfcp_scsi_dev instead of zfcp_unit".

Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org #2.6.37+
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_erp.c |   29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -102,10 +102,13 @@ static void zfcp_erp_action_dismiss_port
 
 	if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_INUSE)
 		zfcp_erp_action_dismiss(&port->erp_action);
-	else
-		shost_for_each_device(sdev, port->adapter->scsi_host)
+	else {
+		spin_lock(port->adapter->scsi_host->host_lock);
+		__shost_for_each_device(sdev, port->adapter->scsi_host)
 			if (sdev_to_zfcp(sdev)->port == port)
 				zfcp_erp_action_dismiss_lun(sdev);
+		spin_unlock(port->adapter->scsi_host->host_lock);
+	}
 }
 
 static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)
@@ -592,9 +595,11 @@ static void _zfcp_erp_lun_reopen_all(str
 {
 	struct scsi_device *sdev;
 
-	shost_for_each_device(sdev, port->adapter->scsi_host)
+	spin_lock(port->adapter->scsi_host->host_lock);
+	__shost_for_each_device(sdev, port->adapter->scsi_host)
 		if (sdev_to_zfcp(sdev)->port == port)
 			_zfcp_erp_lun_reopen(sdev, clear, id, 0);
+	spin_unlock(port->adapter->scsi_host->host_lock);
 }
 
 static void zfcp_erp_strategy_followup_failed(struct zfcp_erp_action *act)
@@ -1434,8 +1439,10 @@ void zfcp_erp_set_adapter_status(struct
 		atomic_set_mask(common_mask, &port->status);
 	read_unlock_irqrestore(&adapter->port_list_lock, flags);
 
-	shost_for_each_device(sdev, adapter->scsi_host)
+	spin_lock_irqsave(adapter->scsi_host->host_lock, flags);
+	__shost_for_each_device(sdev, adapter->scsi_host)
 		atomic_set_mask(common_mask, &sdev_to_zfcp(sdev)->status);
+	spin_unlock_irqrestore(adapter->scsi_host->host_lock, flags);
 }
 
 /**
@@ -1469,11 +1476,13 @@ void zfcp_erp_clear_adapter_status(struc
 	}
 	read_unlock_irqrestore(&adapter->port_list_lock, flags);
 
-	shost_for_each_device(sdev, adapter->scsi_host) {
+	spin_lock_irqsave(adapter->scsi_host->host_lock, flags);
+	__shost_for_each_device(sdev, adapter->scsi_host) {
 		atomic_clear_mask(common_mask, &sdev_to_zfcp(sdev)->status);
 		if (clear_counter)
 			atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
 	}
+	spin_unlock_irqrestore(adapter->scsi_host->host_lock, flags);
 }
 
 /**
@@ -1487,16 +1496,19 @@ void zfcp_erp_set_port_status(struct zfc
 {
 	struct scsi_device *sdev;
 	u32 common_mask = mask & ZFCP_COMMON_FLAGS;
+	unsigned long flags;
 
 	atomic_set_mask(mask, &port->status);
 
 	if (!common_mask)
 		return;
 
-	shost_for_each_device(sdev, port->adapter->scsi_host)
+	spin_lock_irqsave(port->adapter->scsi_host->host_lock, flags);
+	__shost_for_each_device(sdev, port->adapter->scsi_host)
 		if (sdev_to_zfcp(sdev)->port == port)
 			atomic_set_mask(common_mask,
 					&sdev_to_zfcp(sdev)->status);
+	spin_unlock_irqrestore(port->adapter->scsi_host->host_lock, flags);
 }
 
 /**
@@ -1511,6 +1523,7 @@ void zfcp_erp_clear_port_status(struct z
 	struct scsi_device *sdev;
 	u32 common_mask = mask & ZFCP_COMMON_FLAGS;
 	u32 clear_counter = mask & ZFCP_STATUS_COMMON_ERP_FAILED;
+	unsigned long flags;
 
 	atomic_clear_mask(mask, &port->status);
 
@@ -1520,13 +1533,15 @@ void zfcp_erp_clear_port_status(struct z
 	if (clear_counter)
 		atomic_set(&port->erp_counter, 0);
 
-	shost_for_each_device(sdev, port->adapter->scsi_host)
+	spin_lock_irqsave(port->adapter->scsi_host->host_lock, flags);
+	__shost_for_each_device(sdev, port->adapter->scsi_host)
 		if (sdev_to_zfcp(sdev)->port == port) {
 			atomic_clear_mask(common_mask,
 					  &sdev_to_zfcp(sdev)->status);
 			if (clear_counter)
 				atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
 		}
+	spin_unlock_irqrestore(port->adapter->scsi_host->host_lock, flags);
 }
 
 /**

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH RESEND 3/3] zfcp: remove access control tables interface (keep sysfs files)
  2013-08-22 15:45   ` [PATCH RESEND 0/3] zfcp bugfixes for 3.11-rc Steffen Maier
  2013-08-22 15:45     ` [PATCH RESEND 1/3] zfcp: fix lock imbalance by reworking request queue locking Steffen Maier
  2013-08-22 15:45     ` [PATCH RESEND 2/3] zfcp: fix schedule-inside-lock in scsi_device list loops Steffen Maier
@ 2013-08-22 15:45     ` Steffen Maier
  2013-08-22 16:30       ` James Bottomley
  2 siblings, 1 reply; 22+ messages in thread
From: Steffen Maier @ 2013-08-22 15:45 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke, stable

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

By popular demand, this patch brings back a couple of sysfs attributes
removed by commit 663e0890e31cb85f0cca5ac1faaee0d2d52880b5
"[SCSI] zfcp: remove access control tables interface".
The content has been irrelevant for years, but the files must be
there forever for whatever user space tools that may rely on them.

Since these files always return a constant value, a new stripped
down show-macro was required. Otherwise build warnings would have
been introduced.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org #3.11+
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_sysfs.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -27,6 +27,16 @@ static ssize_t zfcp_sysfs_##_feat##_##_n
 static ZFCP_DEV_ATTR(_feat, _name, S_IRUGO,				       \
 		     zfcp_sysfs_##_feat##_##_name##_show, NULL);
 
+#define ZFCP_DEFINE_ATTR_CONST(_feat, _name, _format, _value)		       \
+static ssize_t zfcp_sysfs_##_feat##_##_name##_show(struct device *dev,	       \
+						   struct device_attribute *at,\
+						   char *buf)		       \
+{									       \
+	return sprintf(buf, _format, _value);				       \
+}									       \
+static ZFCP_DEV_ATTR(_feat, _name, S_IRUGO,				       \
+		     zfcp_sysfs_##_feat##_##_name##_show, NULL);
+
 #define ZFCP_DEFINE_A_ATTR(_name, _format, _value)			     \
 static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev,	     \
 						 struct device_attribute *at,\
@@ -75,6 +85,8 @@ ZFCP_DEFINE_ATTR(zfcp_unit, unit, in_rec
 ZFCP_DEFINE_ATTR(zfcp_unit, unit, access_denied, "%d\n",
 		 (zfcp_unit_sdev_status(unit) &
 		  ZFCP_STATUS_COMMON_ACCESS_DENIED) != 0);
+ZFCP_DEFINE_ATTR_CONST(unit, access_shared, "%d\n", 0);
+ZFCP_DEFINE_ATTR_CONST(unit, access_readonly, "%d\n", 0);
 
 static ssize_t zfcp_sysfs_port_failed_show(struct device *dev,
 					   struct device_attribute *attr,
@@ -347,6 +359,8 @@ static struct attribute *zfcp_unit_attrs
 	&dev_attr_unit_in_recovery.attr,
 	&dev_attr_unit_status.attr,
 	&dev_attr_unit_access_denied.attr,
+	&dev_attr_unit_access_shared.attr,
+	&dev_attr_unit_access_readonly.attr,
 	NULL
 };
 static struct attribute_group zfcp_unit_attr_group = {

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH RESEND 0/4] zfcp features for 3.12 merge window
  2013-08-21 15:36 ` [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window James Bottomley
  2013-08-22 15:45   ` [PATCH RESEND 0/3] zfcp bugfixes for 3.11-rc Steffen Maier
@ 2013-08-22 15:49   ` Steffen Maier
  2013-08-22 15:49     ` [PATCH RESEND 1/4] zfcp: consistently use appropriate SBAL flag definitions Steffen Maier
                       ` (3 more replies)
  1 sibling, 4 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-22 15:49 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier

James,

as discussed, I split up bugfixes and features in two separate sets.
Here is a resend of zfcp features for the upcoming merge window
preparing kernel v3.12.
The patches apply on top of the current misc branch of your scsi.git.

Compared to the original posting, I had to drop the following patch for now:
 zfcp: remove access control tables interface (port leftovers)
because it only builds on top of another patch from the fixes set
 (zfcp: remove access control tables interface (keep sysfs files))
which defines a new required helper macro.
I'm going to submit the dropped patch later, once the fixes are merged upstream.

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH RESEND 1/4] zfcp: consistently use appropriate SBAL flag definitions
  2013-08-22 15:49   ` [PATCH RESEND 0/4] zfcp features for 3.12 merge window Steffen Maier
@ 2013-08-22 15:49     ` Steffen Maier
  2013-08-22 15:49     ` [PATCH RESEND 2/4] zfcp: cleanup use of obsolete strict_strto* functions Steffen Maier
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-22 15:49 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

minor cleanup for status read request

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_fsf.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -770,7 +770,8 @@ int zfcp_fsf_status_read(struct zfcp_qdi
 	if (zfcp_qdio_sbal_get(qdio))
 		goto out;
 
-	req = zfcp_fsf_req_create(qdio, FSF_QTCB_UNSOLICITED_STATUS, 0,
+	req = zfcp_fsf_req_create(qdio, FSF_QTCB_UNSOLICITED_STATUS,
+				  SBAL_SFLAGS0_TYPE_STATUS,
 				  adapter->pool.status_read_req);
 	if (IS_ERR(req)) {
 		retval = PTR_ERR(req);

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH RESEND 2/4] zfcp: cleanup use of obsolete strict_strto* functions
  2013-08-22 15:49   ` [PATCH RESEND 0/4] zfcp features for 3.12 merge window Steffen Maier
  2013-08-22 15:49     ` [PATCH RESEND 1/4] zfcp: consistently use appropriate SBAL flag definitions Steffen Maier
@ 2013-08-22 15:49     ` Steffen Maier
  2013-08-22 15:49     ` [PATCH RESEND 3/4] zfcp: dead code removal Steffen Maier
  2013-08-22 15:49     ` [PATCH RESEND 4/4] zfcp: enable FCP hardware data router by default Steffen Maier
  3 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-22 15:49 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke, Jingoo Han

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

strict_strtoul and friends are obsolete. Use kstrtoul functions
instead.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_aux.c   |    4 ++--
 drivers/s390/scsi/zfcp_sysfs.c |   12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -104,11 +104,11 @@ static void __init zfcp_init_device_setu
 	strncpy(busid, token, ZFCP_BUS_ID_SIZE);
 
 	token = strsep(&str, ",");
-	if (!token || strict_strtoull(token, 0, (unsigned long long *) &wwpn))
+	if (!token || kstrtoull(token, 0, (unsigned long long *) &wwpn))
 		goto err_out;
 
 	token = strsep(&str, ",");
-	if (!token || strict_strtoull(token, 0, (unsigned long long *) &lun))
+	if (!token || kstrtoull(token, 0, (unsigned long long *) &lun))
 		goto err_out;
 
 	kfree(str_saved);
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -95,7 +95,7 @@ static ssize_t zfcp_sysfs_port_failed_st
 	struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
 	unsigned long val;
 
-	if (strict_strtoul(buf, 0, &val) || val != 0)
+	if (kstrtoul(buf, 0, &val) || val != 0)
 		return -EINVAL;
 
 	zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_RUNNING);
@@ -134,7 +134,7 @@ static ssize_t zfcp_sysfs_unit_failed_st
 	unsigned long val;
 	struct scsi_device *sdev;
 
-	if (strict_strtoul(buf, 0, &val) || val != 0)
+	if (kstrtoul(buf, 0, &val) || val != 0)
 		return -EINVAL;
 
 	sdev = zfcp_unit_sdev(unit);
@@ -184,7 +184,7 @@ static ssize_t zfcp_sysfs_adapter_failed
 	if (!adapter)
 		return -ENODEV;
 
-	if (strict_strtoul(buf, 0, &val) || val != 0) {
+	if (kstrtoul(buf, 0, &val) || val != 0) {
 		retval = -EINVAL;
 		goto out;
 	}
@@ -236,7 +236,7 @@ static ssize_t zfcp_sysfs_port_remove_st
 	if (!adapter)
 		return -ENODEV;
 
-	if (strict_strtoull(buf, 0, (unsigned long long *) &wwpn))
+	if (kstrtoull(buf, 0, (unsigned long long *) &wwpn))
 		goto out;
 
 	port = zfcp_get_port_by_wwpn(adapter, wwpn);
@@ -297,7 +297,7 @@ static ssize_t zfcp_sysfs_unit_add_store
 	u64 fcp_lun;
 	int retval;
 
-	if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
+	if (kstrtoull(buf, 0, (unsigned long long *) &fcp_lun))
 		return -EINVAL;
 
 	retval = zfcp_unit_add(port, fcp_lun);
@@ -315,7 +315,7 @@ static ssize_t zfcp_sysfs_unit_remove_st
 	struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
 	u64 fcp_lun;
 
-	if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
+	if (kstrtoull(buf, 0, (unsigned long long *) &fcp_lun))
 		return -EINVAL;
 
 	if (zfcp_unit_remove(port, fcp_lun))

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH RESEND 3/4] zfcp: dead code removal
  2013-08-22 15:49   ` [PATCH RESEND 0/4] zfcp features for 3.12 merge window Steffen Maier
  2013-08-22 15:49     ` [PATCH RESEND 1/4] zfcp: consistently use appropriate SBAL flag definitions Steffen Maier
  2013-08-22 15:49     ` [PATCH RESEND 2/4] zfcp: cleanup use of obsolete strict_strto* functions Steffen Maier
@ 2013-08-22 15:49     ` Steffen Maier
  2013-08-22 15:49     ` [PATCH RESEND 4/4] zfcp: enable FCP hardware data router by default Steffen Maier
  3 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-22 15:49 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier, Martin Peschke

From: Martin Peschke <mpeschke@linux.vnet.ibm.com>

Get rid of unused function zfcp_fsf_get_req and corresponding
prototype definition.

Commit a54ca0f62f953898b05549391ac2a8a4dad6482b in v2.6.28
"[SCSI] zfcp: Redesign of the debug tracing for HBA records."
accidentally introduced this code which was dead in the first place.

Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_ext.h |    2 --
 drivers/s390/scsi/zfcp_fsf.c |    9 ---------
 2 files changed, 11 deletions(-)

--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -126,8 +126,6 @@ extern int zfcp_qdio_sbals_from_sg(struc
 extern int zfcp_qdio_open(struct zfcp_qdio *);
 extern void zfcp_qdio_close(struct zfcp_qdio *);
 extern void zfcp_qdio_siosl(struct zfcp_adapter *);
-extern struct zfcp_fsf_req *zfcp_fsf_get_req(struct zfcp_qdio *,
-					     struct qdio_buffer *);
 
 /* zfcp_scsi.c */
 extern struct scsi_transport_template *zfcp_scsi_transport_template;
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2388,12 +2388,3 @@ void zfcp_fsf_reqid_check(struct zfcp_qd
 			break;
 	}
 }
-
-struct zfcp_fsf_req *zfcp_fsf_get_req(struct zfcp_qdio *qdio,
-				      struct qdio_buffer *sbal)
-{
-	struct qdio_buffer_element *sbale = &sbal->element[0];
-	u64 req_id = (unsigned long) sbale->addr;
-
-	return zfcp_reqlist_find(qdio->adapter->req_list, req_id);
-}

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH RESEND 4/4] zfcp: enable FCP hardware data router by default
  2013-08-22 15:49   ` [PATCH RESEND 0/4] zfcp features for 3.12 merge window Steffen Maier
                       ` (2 preceding siblings ...)
  2013-08-22 15:49     ` [PATCH RESEND 3/4] zfcp: dead code removal Steffen Maier
@ 2013-08-22 15:49     ` Steffen Maier
  3 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-22 15:49 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Steffen Maier

Enabling the data router support by default
can increase performance in certain situations.
It is safe to do so and tolerated in LPAR and under z/VM
in case there is no data router support in that environment.

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Reviewed-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
---
 drivers/s390/scsi/zfcp_qdio.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -16,9 +16,9 @@
 
 #define QBUFF_PER_PAGE		(PAGE_SIZE / sizeof(struct qdio_buffer))
 
-static bool enable_multibuffer;
+static bool enable_multibuffer = 1;
 module_param_named(datarouter, enable_multibuffer, bool, 0400);
-MODULE_PARM_DESC(datarouter, "Enable hardware data router support");
+MODULE_PARM_DESC(datarouter, "Enable hardware data router support (default on)");
 
 static int zfcp_qdio_buffers_enqueue(struct qdio_buffer **sbal)
 {

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH RESEND 3/3] zfcp: remove access control tables interface (keep sysfs files)
  2013-08-22 15:45     ` [PATCH RESEND 3/3] zfcp: remove access control tables interface (keep sysfs files) Steffen Maier
@ 2013-08-22 16:30       ` James Bottomley
  2013-08-22 16:40         ` Steffen Maier
  0 siblings, 1 reply; 22+ messages in thread
From: James Bottomley @ 2013-08-22 16:30 UTC (permalink / raw)
  To: Steffen Maier
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Martin Peschke

On Thu, 2013-08-22 at 17:45 +0200, Steffen Maier wrote:
> From: Martin Peschke <mpeschke@linux.vnet.ibm.com>
> 
> By popular demand, this patch brings back a couple of sysfs attributes
> removed by commit 663e0890e31cb85f0cca5ac1faaee0d2d52880b5
> "[SCSI] zfcp: remove access control tables interface".
> The content has been irrelevant for years, but the files must be
> there forever for whatever user space tools that may rely on them.
> 
> Since these files always return a constant value, a new stripped
> down show-macro was required. Otherwise build warnings would have
> been introduced.
> 
> Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
> Cc: stable@vger.kernel.org #3.11+

If I'm sending this for 3.11-rc, this stable tag is unnecessary, right?
It will go into 3.11 and you don't want it for 3.10.

James

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH RESEND 3/3] zfcp: remove access control tables interface (keep sysfs files)
  2013-08-22 16:30       ` James Bottomley
@ 2013-08-22 16:40         ` Steffen Maier
  0 siblings, 0 replies; 22+ messages in thread
From: Steffen Maier @ 2013-08-22 16:40 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Martin Peschke

On 08/22/2013 06:30 PM, James Bottomley wrote:
> On Thu, 2013-08-22 at 17:45 +0200, Steffen Maier wrote:
>> From: Martin Peschke <mpeschke@linux.vnet.ibm.com>
>>
>> By popular demand, this patch brings back a couple of sysfs attributes
>> removed by commit 663e0890e31cb85f0cca5ac1faaee0d2d52880b5
>> "[SCSI] zfcp: remove access control tables interface".
>> The content has been irrelevant for years, but the files must be
>> there forever for whatever user space tools that may rely on them.
>>
>> Since these files always return a constant value, a new stripped
>> down show-macro was required. Otherwise build warnings would have
>> been introduced.
>>
>> Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
>> Cc: stable@vger.kernel.org #3.11+
>
> If I'm sending this for 3.11-rc, this stable tag is unnecessary, right?
> It will go into 3.11 and you don't want it for 3.10.

Correct, it's a no-op, my bad.

-- 
Mit freundlichen Grüßen / Kind regards
Steffen Maier

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2013-08-22 16:40 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-21 15:05 [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window Steffen Maier
2013-08-21 15:05 ` [PATCH 1/8] zfcp: consistently use appropriate SBAL flag definitions Steffen Maier
2013-08-21 15:05 ` [PATCH 2/8] zfcp: cleanup use of obsolete strict_strto* functions Steffen Maier
2013-08-22  0:08   ` Jingoo Han
2013-08-21 15:05 ` [PATCH 3/8] zfcp: dead code removal Steffen Maier
2013-08-21 15:05 ` [PATCH 4/8] zfcp: fix lock imbalance by reworking request queue locking Steffen Maier
2013-08-21 15:05 ` [PATCH 5/8] zfcp: fix schedule-inside-lock in scsi_device list loops Steffen Maier
2013-08-21 15:05 ` [PATCH 6/8] zfcp: remove access control tables interface (keep sysfs files) Steffen Maier
2013-08-21 15:05 ` [PATCH 7/8] zfcp: remove access control tables interface (port leftovers) Steffen Maier
2013-08-21 15:05 ` [PATCH 8/8] zfcp: enable FCP hardware data router by default Steffen Maier
2013-08-21 15:36 ` [PATCH 0/8] zfcp features and bugfixes for 3.12 merge window James Bottomley
2013-08-22 15:45   ` [PATCH RESEND 0/3] zfcp bugfixes for 3.11-rc Steffen Maier
2013-08-22 15:45     ` [PATCH RESEND 1/3] zfcp: fix lock imbalance by reworking request queue locking Steffen Maier
2013-08-22 15:45     ` [PATCH RESEND 2/3] zfcp: fix schedule-inside-lock in scsi_device list loops Steffen Maier
2013-08-22 15:45     ` [PATCH RESEND 3/3] zfcp: remove access control tables interface (keep sysfs files) Steffen Maier
2013-08-22 16:30       ` James Bottomley
2013-08-22 16:40         ` Steffen Maier
2013-08-22 15:49   ` [PATCH RESEND 0/4] zfcp features for 3.12 merge window Steffen Maier
2013-08-22 15:49     ` [PATCH RESEND 1/4] zfcp: consistently use appropriate SBAL flag definitions Steffen Maier
2013-08-22 15:49     ` [PATCH RESEND 2/4] zfcp: cleanup use of obsolete strict_strto* functions Steffen Maier
2013-08-22 15:49     ` [PATCH RESEND 3/4] zfcp: dead code removal Steffen Maier
2013-08-22 15:49     ` [PATCH RESEND 4/4] zfcp: enable FCP hardware data router by default Steffen Maier

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).