From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ursula Braun Subject: [patch 2/8] [PATCH] af_iucv: sync sk shutdown flag if iucv path is quiesced Date: Wed, 22 Apr 2009 11:26:21 +0200 Message-ID: <20090422093429.939908000@linux.vnet.ibm.com> References: <20090422092619.451973000@linux.vnet.ibm.com> Cc: schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, Hendrik Brueckner , Ursula Braun To: davem@davemloft.net, netdev@vger.kernel.org, linux-s390@vger.kernel.org Return-path: Received: from mtagate2.de.ibm.com ([195.212.17.162]:55193 "EHLO mtagate2.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751476AbZDVJec (ORCPT ); Wed, 22 Apr 2009 05:34:32 -0400 Content-Disposition: inline; filename=605-af_iucv-sync-shutdown.diff Sender: netdev-owner@vger.kernel.org List-ID: From: Hendrik Brueckner If the af_iucv communication partner quiesces the path to shutdown its receive direction, provide a quiesce callback implementation to shutdown the (local) send direction. This ensures that both sides are synchronized. Signed-off-by: Hendrik Brueckner Signed-off-by: Ursula Braun --- net/iucv/af_iucv.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) Index: net-next-2.6-uschi/net/iucv/af_iucv.c =================================================================== --- net-next-2.6-uschi.orig/net/iucv/af_iucv.c +++ net-next-2.6-uschi/net/iucv/af_iucv.c @@ -54,6 +54,7 @@ static void iucv_callback_connack(struct static int iucv_callback_connreq(struct iucv_path *, u8 ipvmid[8], u8 ipuser[16]); static void iucv_callback_connrej(struct iucv_path *, u8 ipuser[16]); +static void iucv_callback_shutdown(struct iucv_path *, u8 ipuser[16]); static struct iucv_sock_list iucv_sk_list = { .lock = __RW_LOCK_UNLOCKED(iucv_sk_list.lock), @@ -65,7 +66,8 @@ static struct iucv_handler af_iucv_handl .path_complete = iucv_callback_connack, .path_severed = iucv_callback_connrej, .message_pending = iucv_callback_rx, - .message_complete = iucv_callback_txdone + .message_complete = iucv_callback_txdone, + .path_quiesced = iucv_callback_shutdown, }; static inline void high_nmcpy(unsigned char *dst, char *src) @@ -1196,6 +1198,21 @@ static void iucv_callback_connrej(struct sk->sk_state_change(sk); } +/* called if the other communication side shuts down its RECV direction; + * in turn, the callback sets SEND_SHUTDOWN to disable sending of data. + */ +static void iucv_callback_shutdown(struct iucv_path *path, u8 ipuser[16]) +{ + struct sock *sk = path->private; + + bh_lock_sock(sk); + if (sk->sk_state != IUCV_CLOSED) { + sk->sk_shutdown |= SEND_SHUTDOWN; + sk->sk_state_change(sk); + } + bh_unlock_sock(sk); +} + static struct proto_ops iucv_sock_ops = { .family = PF_IUCV, .owner = THIS_MODULE,