From patchwork Wed Sep 16 14:37:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ursula Braun X-Patchwork-Id: 33715 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 17403B7B83 for ; Thu, 17 Sep 2009 00:44:27 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753103AbZIPOnL (ORCPT ); Wed, 16 Sep 2009 10:43:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752970AbZIPOnK (ORCPT ); Wed, 16 Sep 2009 10:43:10 -0400 Received: from mtagate6.de.ibm.com ([195.212.17.166]:57641 "EHLO mtagate6.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751653AbZIPOnC (ORCPT ); Wed, 16 Sep 2009 10:43:02 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.1/8.13.1) with ESMTP id n8GEh5xn003805; Wed, 16 Sep 2009 14:43:05 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n8GEh58i2691238; Wed, 16 Sep 2009 16:43:05 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n8GEh4o7028347; Wed, 16 Sep 2009 16:43:04 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n8GEh4Vt028343; Wed, 16 Sep 2009 16:43:04 +0200 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4267) id 5FC7A1224227; Wed, 16 Sep 2009 16:43:04 +0200 (CEST) Message-Id: <20090916144304.269646000@linux.vnet.ibm.com> User-Agent: quilt/0.47-1 Date: Wed, 16 Sep 2009 16:37:23 +0200 From: Ursula Braun To: davem@davemloft.net, netdev@vger.kernel.org, linux-s390@vger.kernel.org Cc: schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, Hendrik Brueckner , Ursula Braun Subject: [patch 2/7] [PATCH] iucv: fix iucv_buffer_cpumask check when calling IUCV functions References: <20090916143721.863799000@linux.vnet.ibm.com> Content-Disposition: inline; filename=601-iucv-cpumask.diff Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Hendrik Brueckner Prior to calling IUCV functions, the DECLARE BUFFER function must have been called for at least one CPU to receive IUCV interrupts. With commit "iucv: establish reboot notifier" (6c005961), a check has been introduced to avoid calling IUCV functions if the current CPU does not have an interrupt buffer declared. Because one interrupt buffer is sufficient, change the condition to ensure that one interrupt buffer is available. In addition, checking the buffer on the current CPU creates a race with CPU up/down notifications: before checking the buffer, the IUCV function might be interrupted by an smp_call_function() that retrieves the interrupt buffer for the current CPU. When the IUCV function continues, the check fails and -EIO is returned. If a buffer is available on any other CPU, the IUCV function call must be invoked (instead of failing with -EIO). Signed-off-by: Hendrik Brueckner Signed-off-by: Ursula Braun --- net/iucv/iucv.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -urpN linux-2.6/net/iucv/iucv.c linux-2.6-patched/net/iucv/iucv.c --- linux-2.6/net/iucv/iucv.c 2009-09-15 12:25:32.000000000 +0200 +++ linux-2.6-patched/net/iucv/iucv.c 2009-09-15 12:25:32.000000000 +0200 @@ -864,7 +864,7 @@ int iucv_path_accept(struct iucv_path *p int rc; local_bh_disable(); - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; } @@ -913,7 +913,7 @@ int iucv_path_connect(struct iucv_path * spin_lock_bh(&iucv_table_lock); iucv_cleanup_queue(); - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; } @@ -973,7 +973,7 @@ int iucv_path_quiesce(struct iucv_path * int rc; local_bh_disable(); - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; } @@ -1005,7 +1005,7 @@ int iucv_path_resume(struct iucv_path *p int rc; local_bh_disable(); - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; } @@ -1034,7 +1034,7 @@ int iucv_path_sever(struct iucv_path *pa int rc; preempt_disable(); - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; } @@ -1068,7 +1068,7 @@ int iucv_message_purge(struct iucv_path int rc; local_bh_disable(); - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; } @@ -1160,7 +1160,7 @@ int __iucv_message_receive(struct iucv_p if (msg->flags & IUCV_IPRMDATA) return iucv_message_receive_iprmdata(path, msg, flags, buffer, size, residual); - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; } @@ -1233,7 +1233,7 @@ int iucv_message_reject(struct iucv_path int rc; local_bh_disable(); - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; } @@ -1272,7 +1272,7 @@ int iucv_message_reply(struct iucv_path int rc; local_bh_disable(); - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; } @@ -1322,7 +1322,7 @@ int __iucv_message_send(struct iucv_path union iucv_param *parm; int rc; - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; } @@ -1409,7 +1409,7 @@ int iucv_message_send2way(struct iucv_pa int rc; local_bh_disable(); - if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { + if (cpus_empty(iucv_buffer_cpumask)) { rc = -EIO; goto out; }