public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Steffen Maier <maier@linux.vnet.ibm.com>,
	James Bottomley <JBottomley@Parallels.com>
Subject: [ 44/45] [SCSI] zfcp: status read buffers on first adapter open with link down
Date: Fri, 26 Jul 2013 13:58:04 -0700	[thread overview]
Message-ID: <20130726205659.806194031@linuxfoundation.org> (raw)
In-Reply-To: <20130726205654.896050165@linuxfoundation.org>

3.0-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Steffen Maier <maier@linux.vnet.ibm.com>

commit 9edf7d75ee5f21663a0183d21f702682d0ef132f upstream.

Commit 64deb6efdc5504ce97b5c1c6f281fffbc150bd93
"[SCSI] zfcp: Use status_read_buf_num provided by FCP channel"
started using a value returned by the channel but only evaluated the value
if the fabric link is up.
Commit 8d88cf3f3b9af4713642caeb221b6d6a42019001
"[SCSI] zfcp: Update status read mempool"
introduced mempool resizings based on the above value.
On setting an FCP device online for the very first time since boot, a new
zeroed adapter object is allocated. If the link is down, the number of
status read requests remains zero. Since just the config data exchange is
incomplete, we proceed with adapter open recovery. However, we
unconditionally call mempool_resize with adapter->stat_read_buf_num == 0 in
this case.

This causes a kernel message "kernel BUG at mm/mempool.c:131!" in process
"zfcperp<FCP-device-bus-ID>" with last function mempool_resize in Krnl PSW
and zfcp_erp_thread in the Call Trace.

Don't evaluate channel values which are invalid on link down. The number of
status read requests is always valid, evaluated, and set to a positive
minimum greater than zero. The adapter open recovery can proceed and the
channel has status read buffers to inform us on a future link up event.
While we are not aware of any other code path that could result in mempool
resize attempts of size zero, we still also initialize the number of status
read buffers to be posted to a static minimum number on adapter object
allocation.

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
[sm: Backported to 3.0:
 - Copyright notice changed slightly
 - Don't use zfcp_fsf_convert_portspeed()]
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/s390/scsi/zfcp_aux.c |    5 ++++-
 drivers/s390/scsi/zfcp_fsf.c |   21 +++++++++++++++------
 2 files changed, 19 insertions(+), 7 deletions(-)

--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -3,7 +3,7 @@
  *
  * Module interface and handling of zfcp data structures.
  *
- * Copyright IBM Corporation 2002, 2010
+ * Copyright IBM Corp. 2002, 2013
  */
 
 /*
@@ -23,6 +23,7 @@
  *            Christof Schmitt
  *            Martin Petermann
  *            Sven Schuetz
+ *            Steffen Maier
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -414,6 +415,8 @@ struct zfcp_adapter *zfcp_adapter_enqueu
 	adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN;
 	adapter->ccw_device->dev.dma_parms = &adapter->dma_parms;
 
+	adapter->stat_read_buf_num = FSF_STATUS_READS_RECOM;
+
 	if (!zfcp_scsi_adapter_register(adapter))
 		return adapter;
 
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -3,7 +3,7 @@
  *
  * Implementation of FSF commands.
  *
- * Copyright IBM Corporation 2002, 2010
+ * Copyright IBM Corp. 2002, 2013
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -455,11 +455,8 @@ static int zfcp_fsf_exchange_config_eval
 
 	fc_host_port_name(shost) = nsp->fl_wwpn;
 	fc_host_node_name(shost) = nsp->fl_wwnn;
-	fc_host_port_id(shost) = ntoh24(bottom->s_id);
-	fc_host_speed(shost) = bottom->fc_link_speed;
 	fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
 
-	adapter->hydra_version = bottom->adapter_type;
 	adapter->timer_ticks = bottom->timer_interval & ZFCP_FSF_TIMER_INT_MASK;
 	adapter->stat_read_buf_num = max(bottom->status_read_buf_num,
 					 (u16)FSF_STATUS_READS_RECOM);
@@ -467,6 +464,18 @@ static int zfcp_fsf_exchange_config_eval
 	if (fc_host_permanent_port_name(shost) == -1)
 		fc_host_permanent_port_name(shost) = fc_host_port_name(shost);
 
+	zfcp_scsi_set_prot(adapter);
+
+	/* no error return above here, otherwise must fix call chains */
+	/* do not evaluate invalid fields */
+	if (req->qtcb->header.fsf_status == FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE)
+		return 0;
+
+	fc_host_port_id(shost) = ntoh24(bottom->s_id);
+	fc_host_speed(shost) = bottom->fc_link_speed;
+
+	adapter->hydra_version = bottom->adapter_type;
+
 	switch (bottom->fc_topology) {
 	case FSF_TOPO_P2P:
 		adapter->peer_d_id = ntoh24(bottom->peer_d_id);
@@ -488,8 +497,6 @@ static int zfcp_fsf_exchange_config_eval
 		return -EIO;
 	}
 
-	zfcp_scsi_set_prot(adapter);
-
 	return 0;
 }
 
@@ -540,6 +547,8 @@ static void zfcp_fsf_exchange_config_dat
 				&adapter->status);
 		zfcp_fsf_link_down_info_eval(req,
 			&qtcb->header.fsf_status_qual.link_down_info);
+		if (zfcp_fsf_exchange_config_evaluate(req))
+			return;
 		break;
 	default:
 		zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh3");



  parent reply	other threads:[~2013-07-26 21:01 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 20:57 [ 00/45] 3.0.88-stable review Greg Kroah-Hartman
2013-07-26 20:57 ` [ 01/45] tick: Prevent uncontrolled switch to oneshot mode Greg Kroah-Hartman
2013-07-26 20:57 ` [ 02/45] ASoC: sglt5000: Fix SGTL5000_PLL_FRAC_DIV_MASK Greg Kroah-Hartman
2013-07-26 20:57 ` [ 03/45] rt2x00: read 5GHz TX power values from the correct offset Greg Kroah-Hartman
2013-07-26 20:57 ` [ 04/45] SCSI: zfcp: fix adapter (re)open recovery while link to SAN is down Greg Kroah-Hartman
2013-07-26 20:57 ` [ 05/45] SCSI: mpt2sas: fix firmware failure with wrong task attribute Greg Kroah-Hartman
2013-07-26 20:57 ` [ 06/45] tracing: Use current_uid() for critical time tracing Greg Kroah-Hartman
2013-07-26 20:57 ` [ 07/45] perf: Clone child context from parent context pmu Greg Kroah-Hartman
2013-07-26 20:57 ` [ 08/45] perf: Remove WARN_ON_ONCE() check in __perf_event_enable() for valid scenario Greg Kroah-Hartman
2013-07-26 20:57 ` [ 09/45] perf: Fix perf_lock_task_context() vs RCU Greg Kroah-Hartman
2013-07-26 20:57 ` [ 10/45] sparc32: vm_area_struct access for old Sun SPARCs Greg Kroah-Hartman
2013-07-26 20:57 ` [ 11/45] sparc64 address-congruence property Greg Kroah-Hartman
2013-07-26 20:57 ` [ 12/45] sparc: tsb must be flushed before tlb Greg Kroah-Hartman
2013-07-26 20:57 ` [ 13/45] bridge: fix switched interval for MLD Query types Greg Kroah-Hartman
2013-07-26 20:57 ` [ 14/45] ipv6: dont call addrconf_dst_alloc again when enable lo Greg Kroah-Hartman
2013-07-26 20:57 ` [ 15/45] ipv6: ip6_sk_dst_check() must not assume ipv6 dst Greg Kroah-Hartman
2013-07-26 20:57 ` [ 16/45] af_key: fix info leaks in notify messages Greg Kroah-Hartman
2013-07-26 20:57 ` [ 17/45] neighbour: fix a race in neigh_destroy() Greg Kroah-Hartman
2013-07-26 20:57 ` [ 18/45] x25: Fix broken locking in ioctl error paths Greg Kroah-Hartman
2013-07-26 20:57 ` [ 19/45] net: Swap ver and type in pppoe_hdr Greg Kroah-Hartman
2013-07-26 20:57 ` [ 20/45] ipv6,mcast: always hold idev->lock before mca_lock Greg Kroah-Hartman
2013-07-26 20:57 ` [ 21/45] l2tp: add missing .owner to struct pppox_proto Greg Kroah-Hartman
2013-07-26 20:57 ` [ 22/45] ipv6: call udp_push_pending_frames when uncorking a socket with AF_INET pending data Greg Kroah-Hartman
2013-07-26 20:57 ` [ 23/45] sunvnet: vnet_port_remove must call unregister_netdev Greg Kroah-Hartman
2013-07-26 20:57 ` [ 24/45] ifb: fix rcu_sched self-detected stalls Greg Kroah-Hartman
2013-07-26 20:57 ` [ 25/45] dummy: fix oops when loading the dummy failed Greg Kroah-Hartman
2013-07-26 20:57 ` [ 26/45] ifb: fix oops when loading the ifb failed Greg Kroah-Hartman
2013-07-26 20:57 ` [ 27/45] vlan: fix a race in egress prio management Greg Kroah-Hartman
2013-07-26 20:57 ` [ 28/45] writeback: Fix periodic writeback after fs mount Greg Kroah-Hartman
2013-07-26 20:57 ` [ 29/45] SCSI: megaraid_sas: fix memory leak if SGL has zero length entries Greg Kroah-Hartman
2013-07-26 20:57 ` [ 30/45] SCSI: Fix incorrect memset in bnx2fc_parse_fcp_rsp Greg Kroah-Hartman
2013-07-26 20:57 ` [ 31/45] usb: serial: option: blacklist ONDA MT689DC QMI interface Greg Kroah-Hartman
2013-07-26 20:57 ` [ 32/45] usb: option: add TP-LINK MA260 Greg Kroah-Hartman
2013-07-26 20:57 ` [ 33/45] usb: serial: option: add Olivetti Olicard 200 Greg Kroah-Hartman
2013-07-26 20:57 ` [ 34/45] usb: serial: option.c: remove ONDA MT825UP product ID fromdriver Greg Kroah-Hartman
2013-07-26 20:57 ` [ 35/45] USB: option: append Petatel NP10T device to GSM modems list Greg Kroah-Hartman
2013-07-26 20:57 ` [ 36/45] USB: option: add D-Link DWM-152/C1 and DWM-156/C1 Greg Kroah-Hartman
2013-07-26 20:57 ` [ 37/45] usb: serial: option: Add ONYX 3G device support Greg Kroah-Hartman
2013-07-26 20:57 ` [ 38/45] usb: serial: cp210x: Add USB ID for Netgear Switches embedded serial adapter Greg Kroah-Hartman
2013-07-26 20:57 ` [ 39/45] USB: cp210x: add MMB and PI ZigBee USB Device Support Greg Kroah-Hartman
2013-07-26 20:58 ` [ 40/45] usb: cp210x support SEL C662 Vendor/Device Greg Kroah-Hartman
2013-07-26 20:58 ` [ 41/45] lockd: protect nlm_blocked access in nlmsvc_retry_blocked Greg Kroah-Hartman
2013-07-26 20:58 ` [ 42/45] tracing: Fix irqs-off tag display in syscall tracing Greg Kroah-Hartman
2013-07-26 20:58 ` [ 43/45] hrtimers: Move SMP function call to thread context Greg Kroah-Hartman
2013-07-26 20:58 ` Greg Kroah-Hartman [this message]
2013-07-26 20:58 ` [ 45/45] ALSA: usb-audio: 6fire: return correct XRUN indication Greg Kroah-Hartman
2013-07-27 11:22 ` [ 00/45] 3.0.88-stable review linux
2013-07-27 23:30   ` Ben Hutchings
2013-07-28  1:31     ` Guenter Roeck
2013-07-28 18:39     ` Greg Kroah-Hartman

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=20130726205659.806194031@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=JBottomley@Parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maier@linux.vnet.ibm.com \
    --cc=stable@vger.kernel.org \
    /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