From: Ursula Braun <ursula.braun@de.ibm.com>
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 <brueckner@linux.vnet.ibm.com>,
Ursula Braun <ursula.braun@de.ibm.com>
Subject: [patch 2/7] [PATCH] iucv: fix iucv_buffer_cpumask check when calling IUCV functions
Date: Wed, 16 Sep 2009 16:37:23 +0200 [thread overview]
Message-ID: <20090916144304.269646000@linux.vnet.ibm.com> (raw)
In-Reply-To: 20090916143721.863799000@linux.vnet.ibm.com
[-- Attachment #1: 601-iucv-cpumask.diff --]
[-- Type: text/plain, Size: 4004 bytes --]
From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
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 <brueckner@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
net/iucv/iucv.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
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;
}
next prev parent reply other threads:[~2009-09-16 14:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 14:37 [patch 0/7] s390: iucv / af_iucv fixes for 2.6.31+ Ursula Braun
2009-09-16 14:37 ` [patch 1/7] [PATCH] iucv: suspend/resume error msg for left over pathes Ursula Braun
2009-09-16 14:37 ` Ursula Braun [this message]
2009-09-16 14:37 ` [patch 3/7] [PATCH] iucv: use correct output register in iucv_query_maxconn() Ursula Braun
2009-09-16 14:37 ` [patch 4/7] [PATCH] af_iucv: fix race in __iucv_sock_wait() Ursula Braun
2009-09-16 14:37 ` [patch 5/7] [PATCH] af_iucv: handle non-accepted sockets after resuming from suspend Ursula Braun
2009-09-16 14:37 ` [patch 6/7] [PATCH] af_iucv: do not call iucv_sock_kill() twice Ursula Braun
2009-09-16 14:37 ` [patch 7/7] [PATCH] af_iucv: fix race when queueing skbs on the backlog queue Ursula Braun
2009-09-17 3:58 ` [patch 0/7] s390: iucv / af_iucv fixes for 2.6.31+ David Miller
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=20090916144304.269646000@linux.vnet.ibm.com \
--to=ursula.braun@de.ibm.com \
--cc=brueckner@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@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).