[PATCH] NET: Add the helper kernel_sock_shutdown()

Previous thread: [PATCH 01/05] r8169: add PCI ID for the 8168 in the Abit Fatal1ty F-190HD motherboard by Francois Romieu on Thursday, November 8, 2007 - 4:08 pm. (7 messages)

Next thread: Re: [PATCH] NET: Add the helper kernel_sock_shutdown() by David Howells on Thursday, November 8, 2007 - 6:44 pm. (1 message)
From: Trond Myklebust
Date: Thursday, November 8, 2007 - 6:01 pm

From: Trond Myklebust <Trond.Myklebust@netapp.com>

...and fix a couple of bugs in the NBD, CIFS and OCFS2 socket handlers.

Looking at the sock->op->shutdown() handlers, it looks as if all of them
take a SHUT_RD/SHUT_WR/SHUT_RDWR argument instead of the
RCV_SHUTDOWN/SEND_SHUTDOWN arguments.
Add a helper, and then define the SHUT_* enum to ensure that kernel users
of shutdown() don't get confused.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Paul Clements <Paul.Clements@steeleye.com>
Cc: Mark Fasheh <mark.fasheh@oracle.com>
Cc: Steve French <sfrench@samba.org>
Cc: David Howells <dhowells@redhat.com>
Cc: David S Miller <davem@davemloft.net>
---

 drivers/block/nbd.c    |    3 ++-
 fs/cifs/connect.c      |    2 +-
 fs/ocfs2/cluster/tcp.c |    4 ++--
 include/linux/net.h    |    7 +++++++
 net/rxrpc/ar-local.c   |    4 ++--
 net/socket.c           |    6 ++++++
 6 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 6332aca..b4c0888 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -28,6 +28,7 @@
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <net/sock.h>
+#include <linux/net.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -126,7 +127,7 @@ static void sock_shutdown(struct nbd_device *lo, int lock)
 	if (lo->sock) {
 		printk(KERN_WARNING "%s: shutting down socket\n",
 			lo->disk->disk_name);
-		lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN);
+		kernel_sock_shutdown(lo->sock, SHUT_RDWR);
 		lo->sock = NULL;
 	}
 	if (lock)
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 19ee11f..bea0d2e 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -160,7 +160,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
 	if (server->ssocket) {
 		cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state,
 			server->ssocket->flags));
-		server->ssocket->ops->shutdown(server->ssocket, ...
Previous thread: [PATCH 01/05] r8169: add PCI ID for the 8168 in the Abit Fatal1ty F-190HD motherboard by Francois Romieu on Thursday, November 8, 2007 - 4:08 pm. (7 messages)

Next thread: Re: [PATCH] NET: Add the helper kernel_sock_shutdown() by David Howells on Thursday, November 8, 2007 - 6:44 pm. (1 message)