* [patch 1/3] From: Jennifer Hunt <jenhunt@us.ibm.com>
2007-07-13 8:50 [patch 0/3] [AF_IUCV/IUCV] fixes for net-2.6.23 Ursula Braun
@ 2007-07-13 8:50 ` Ursula Braun
2007-07-15 2:03 ` David Miller
2007-07-13 8:50 ` [patch 2/3] s390: iucv - avoid deadlock between iucv_path_connect and tasklet Ursula Braun
2007-07-13 8:50 ` [patch 3/3] s390: af_iucv: add lock when updating accept_q Ursula Braun
2 siblings, 1 reply; 7+ messages in thread
From: Ursula Braun @ 2007-07-13 8:50 UTC (permalink / raw)
To: davem, netdev, linux-s390; +Cc: Jennifer Hunt, Frank Pavlic
[-- Attachment #1: 200-iucv-kconfig.diff --]
[-- Type: text/plain, Size: 1165 bytes --]
[PATCH] s390: iucv Kconfig.
Improve description of IUCV and AFIUCV configuration options.
Signed-off-by: Jennifer Hunt <jenhunt@us.ibm.com>
Signed-off-by: Ursula Braun >braunu@de.ibm.com>
Acked-by: Frank Pavlic <fpavlic@de.ibm.com>
---
net/iucv/Kconfig | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
Index: net-2.6-uschi/net/iucv/Kconfig
===================================================================
--- net-2.6-uschi.orig/net/iucv/Kconfig
+++ net-2.6-uschi/net/iucv/Kconfig
@@ -1,13 +1,13 @@
config IUCV
- tristate "IUCV support (VM only)"
+ tristate "IUCV support (S390 - z/VM only)"
depends on S390
help
- Select this option if you want to use inter-user communication under
- VM or VIF sockets. If you run on z/VM, say "Y" to enable a fast
+ Select this option if you want to use inter-user communication
+ under VM or VIF. If you run on z/VM, say "Y" to enable a fast
communication link between VM guests.
config AFIUCV
- tristate "AF_IUCV support (VM only)"
+ tristate "AF_IUCV support (S390 - z/VM only)"
depends on IUCV
help
Select this option if you want to use inter-user communication under
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 2/3] s390: iucv - avoid deadlock between iucv_path_connect and tasklet
2007-07-13 8:50 [patch 0/3] [AF_IUCV/IUCV] fixes for net-2.6.23 Ursula Braun
2007-07-13 8:50 ` [patch 1/3] From: Jennifer Hunt <jenhunt@us.ibm.com> Ursula Braun
@ 2007-07-13 8:50 ` Ursula Braun
2007-07-15 2:03 ` David Miller
2007-07-13 8:50 ` [patch 3/3] s390: af_iucv: add lock when updating accept_q Ursula Braun
2 siblings, 1 reply; 7+ messages in thread
From: Ursula Braun @ 2007-07-13 8:50 UTC (permalink / raw)
To: davem, netdev, linux-s390; +Cc: Frank Pavlic
[-- Attachment #1: 201-iucv-trylock.diff --]
[-- Type: text/plain, Size: 1113 bytes --]
From: Ursula Braun <braunu@de.ibm.com>
An iucv deadlock may occur, where one CPU is spinning on the
iucv_table_lock for iucv_tasklet_fn(), while another CPU is holding
the iucv_table_lock for an iucv_path_connect() and is waiting for
the first CPU in an smp_call_function.
Solution: replace spin_lock in iucv_tasklet_fn by spin_trylock and
reschedule tasklet in case of non-granted lock.
Signed-off-by: Ursula Braun <braunu@de.ibm.com>
Acked-by: Frank Pavlic <fpavlic@de.ibm.com>
---
net/iucv/iucv.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletion(-)
Index: net-2.6-uschi/net/iucv/iucv.c
===================================================================
--- net-2.6-uschi.orig/net/iucv/iucv.c
+++ net-2.6-uschi/net/iucv/iucv.c
@@ -1494,7 +1494,10 @@ static void iucv_tasklet_fn(unsigned lon
struct iucv_irq_list *p, *n;
/* Serialize tasklet, iucv_path_sever and iucv_path_connect. */
- spin_lock(&iucv_table_lock);
+ if (!spin_trylock(&iucv_table_lock)) {
+ tasklet_schedule(&iucv_tasklet);
+ return;
+ }
iucv_active_cpu = smp_processor_id();
spin_lock_irq(&iucv_queue_lock);
--
^ permalink raw reply [flat|nested] 7+ messages in thread* [patch 3/3] s390: af_iucv: add lock when updating accept_q
2007-07-13 8:50 [patch 0/3] [AF_IUCV/IUCV] fixes for net-2.6.23 Ursula Braun
2007-07-13 8:50 ` [patch 1/3] From: Jennifer Hunt <jenhunt@us.ibm.com> Ursula Braun
2007-07-13 8:50 ` [patch 2/3] s390: iucv - avoid deadlock between iucv_path_connect and tasklet Ursula Braun
@ 2007-07-13 8:50 ` Ursula Braun
2007-07-15 2:05 ` David Miller
2 siblings, 1 reply; 7+ messages in thread
From: Ursula Braun @ 2007-07-13 8:50 UTC (permalink / raw)
To: davem, netdev, linux-s390; +Cc: Frank Pavlic
[-- Attachment #1: 202-iucv-locking.diff --]
[-- Type: text/plain, Size: 2867 bytes --]
From: Ursula Braun <braunu@de.ibm.com>
The accept_queue of an af_iucv socket will be corrupted, if
adding and deleting of entries in this queue occurs at the
same time (connect request from one client, while accept call
is processed for another client).
Solution: add locking when updating accept_q
Signed-off-by: Ursula Braun <braunu@de.ibm.com>
Acked-by: Frank Pavlic <fpavlic@de.ibm.com>
---
include/net/iucv/af_iucv.h | 1 +
net/iucv/af_iucv.c | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
Index: net-2.6-uschi/include/net/iucv/af_iucv.h
===================================================================
--- net-2.6-uschi.orig/include/net/iucv/af_iucv.h
+++ net-2.6-uschi/include/net/iucv/af_iucv.h
@@ -60,6 +60,7 @@ struct iucv_sock {
char dst_user_id[8];
char dst_name[8];
struct list_head accept_q;
+ spinlock_t accept_q_lock;
struct sock *parent;
struct iucv_path *path;
struct sk_buff_head send_skb_q;
Index: net-2.6-uschi/net/iucv/af_iucv.c
===================================================================
--- net-2.6-uschi.orig/net/iucv/af_iucv.c
+++ net-2.6-uschi/net/iucv/af_iucv.c
@@ -219,6 +219,7 @@ static struct sock *iucv_sock_alloc(stru
sock_init_data(sock, sk);
INIT_LIST_HEAD(&iucv_sk(sk)->accept_q);
+ spin_lock_init(&iucv_sk(sk)->accept_q_lock);
skb_queue_head_init(&iucv_sk(sk)->send_skb_q);
skb_queue_head_init(&iucv_sk(sk)->backlog_skb_q);
iucv_sk(sk)->send_tag = 0;
@@ -274,15 +275,25 @@ void iucv_sock_unlink(struct iucv_sock_l
void iucv_accept_enqueue(struct sock *parent, struct sock *sk)
{
+ unsigned long flags;
+ struct iucv_sock *par = iucv_sk(parent);
+
sock_hold(sk);
- list_add_tail(&iucv_sk(sk)->accept_q, &iucv_sk(parent)->accept_q);
+ spin_lock_irqsave(&par->accept_q_lock, flags);
+ list_add_tail(&iucv_sk(sk)->accept_q, &par->accept_q);
+ spin_unlock_irqrestore(&par->accept_q_lock, flags);
iucv_sk(sk)->parent = parent;
parent->sk_ack_backlog++;
}
void iucv_accept_unlink(struct sock *sk)
{
+ unsigned long flags;
+ struct iucv_sock *par = iucv_sk(iucv_sk(sk)->parent);
+
+ spin_lock_irqsave(&par->accept_q_lock, flags);
list_del_init(&iucv_sk(sk)->accept_q);
+ spin_unlock_irqrestore(&par->accept_q_lock, flags);
iucv_sk(sk)->parent->sk_ack_backlog--;
iucv_sk(sk)->parent = NULL;
sock_put(sk);
@@ -298,8 +309,8 @@ struct sock *iucv_accept_dequeue(struct
lock_sock(sk);
if (sk->sk_state == IUCV_CLOSED) {
- release_sock(sk);
iucv_accept_unlink(sk);
+ release_sock(sk);
continue;
}
@@ -879,6 +890,7 @@ static int iucv_callback_connreq(struct
/* Find out if this path belongs to af_iucv. */
read_lock(&iucv_sk_list.lock);
iucv = NULL;
+ sk = NULL;
sk_for_each(sk, node, &iucv_sk_list.head)
if (sk->sk_state == IUCV_LISTEN &&
!memcmp(&iucv_sk(sk)->src_name, src_name, 8)) {
--
^ permalink raw reply [flat|nested] 7+ messages in thread