Linux-kernel mailing list archive 1997-49,: minor patch for 2.1.72 sunrpc

# minor patch for 2.1.72 sunrpc

Bill Hawes (whawes@star.net)
Sat, 13 Dec 1997 08:46:57 -0500

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Bill Hawes: "Re: Write to nfs fs gives I/O Error"
- Previous message: Eberhard Burr: "Re: Console handling (was: Re: Let's vote for PnP on 2.2)"

This is a multi-part message in MIME format.
--------------2767D1BF7A5CAF5C7D5559A6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The attached patch moves some code common to lockd and nfsd into the
sunrpc module, following the suggestion commented in lockd.

The patch also enables retries after a "garbage args" reply.

Regards,
Bill
--------------2767D1BF7A5CAF5C7D5559A6
Content-Type: text/plain; charset=us-ascii; name="sunrpc_72-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="sunrpc_72-patch"

--- linux-2.1.72/fs/lockd/svc.c.old Mon Dec 1 11:14:13 1997
+++ linux-2.1.72/fs/lockd/svc.c Fri Dec 12 22:07:02 1997
@@ -202,22 +202,6 @@
}
/*
- * Make a socket for lockd
- * FIXME: Move this to net/sunrpc/svc.c so that we can share this with nfsd.
- */
-static int
-lockd_makesock(struct svc_serv *serv, int protocol, unsigned short port)
-{
- struct sockaddr_in sin;
-
- dprintk("lockd: creating socket proto = %d\n", protocol);
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = INADDR_ANY;
- sin.sin_port = htons(port);
- return svc_create_socket(serv, protocol, &sin);
-}
-
-/*
* Bring up the lockd process if it's not already up.
*/
int
@@ -252,8 +236,8 @@
goto out;
}
- if ((error = lockd_makesock(serv, IPPROTO_UDP, 0)) < 0
- || (error = lockd_makesock(serv, IPPROTO_TCP, 0)) < 0) {
+ if ((error = svc_makesock(serv, IPPROTO_UDP, 0)) < 0
+ || (error = svc_makesock(serv, IPPROTO_TCP, 0)) < 0) {
printk("lockd_up: makesock failed, error=%d\n", error);
goto destroy_and_out;
}
--- linux-2.1.72/fs/nfsd/nfssvc.c.old Fri Dec 5 18:32:36 1997
+++ linux-2.1.72/fs/nfsd/nfssvc.c Fri Dec 12 22:12:11 1997
@@ -43,21 +43,6 @@
static void nfsd(struct svc_rqst *rqstp);
struct timeval nfssvc_boot = { 0, 0 };
-/*
- * Make a socket for nfsd
- */
-static int
-nfsd_makesock(struct svc_serv *serv, int protocol, unsigned short port)
-{
- struct sockaddr_in sin;
-
- dprintk("nfsd: creating socket proto = %d\n", protocol);
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = INADDR_ANY;
- sin.sin_port = htons(port);
- return svc_create_socket(serv, protocol, &sin);
-}
-
int
nfsd_svc(unsigned short port, int nrservs)
{
@@ -65,17 +50,19 @@
int error;
dprintk("nfsd: creating service\n");
+ error = -EINVAL;
if (nrservs < 0)
- return -EINVAL;
+ goto out;
if (nrservs > NFSD_MAXSERVS)
nrservs = NFSD_MAXSERVS;
+ error = -ENOMEM;
serv = svc_create(&nfsd_program, NFSD_BUFSIZE, NFSSVC_XDRSIZE);
if (serv == NULL)
- return -ENOMEM;
+ goto out;
- if ((error = nfsd_makesock(serv, IPPROTO_UDP, port)) < 0
- || (error = nfsd_makesock(serv, IPPROTO_TCP, port)) < 0)
+ if ((error = svc_makesock(serv, IPPROTO_UDP, port)) < 0
+ || (error = svc_makesock(serv, IPPROTO_TCP, port)) < 0)
goto failure;
while (nrservs--) {
@@ -86,6 +73,7 @@
failure:
svc_destroy(serv); /* Release server */
+out:
return error;
}
--- linux-2.1.72/net/sunrpc/clnt.c.old Mon Dec 1 11:14:21 1997
+++ linux-2.1.72/net/sunrpc/clnt.c Wed Dec 10 15:07:01 1997
@@ -753,8 +753,10 @@
rpc_exit(task, error);
return NULL;
}
- if (!(p = rpcauth_checkverf(task, p)))
+ if (!(p = rpcauth_checkverf(task, p))) {
+ printk("call_verify: auth check failed\n");
goto garbage; /* bad verifier, retry */
+ }
switch ((n = ntohl(*p++))) {
case RPC_SUCCESS:
return p;
@@ -768,7 +770,8 @@
garbage:
dprintk("RPC: %4d call_verify: server saw garbage\n", task->tk_pid);
task->tk_client->cl_stats->rpcgarbage++;
- if (0 && task->tk_garb_retry--) {
+ if (task->tk_garb_retry--) {
+ printk("RPC: garbage, retrying %4d\n", task->tk_pid);
task->tk_action = call_encode;
return NULL;
}
--- linux-2.1.72/net/sunrpc/svcsock.c.old Mon Dec 1 23:57:00 1997
+++ linux-2.1.72/net/sunrpc/svcsock.c Fri Dec 12 22:28:49 1997
@@ -886,7 +886,7 @@
/*
* Create socket for RPC service.
*/
-int
+static int
svc_create_socket(struct svc_serv *serv, int protocol, struct sockaddr_in *sin)
{
struct svc_sock *svsk;
@@ -969,3 +969,19 @@
/* svsk->sk_server = NULL; */
}
}
+
+/*
+ * Make a socket for nfsd and lockd
+ */
+int
+svc_makesock(struct svc_serv *serv, int protocol, unsigned short port)
+{
+ struct sockaddr_in sin;
+
+ dprintk("svc: creating socket proto = %d\n", protocol);
+ sin.sin_family = AF_INET;
+ sin.sin_addr.s_addr = INADDR_ANY;
+ sin.sin_port = htons(port);
+ return svc_create_socket(serv, protocol, &sin);
+}
+
--- linux-2.1.72/net/sunrpc/sunrpc_syms.c.old Mon Dec 1 11:14:21 1997
+++ linux-2.1.72/net/sunrpc/sunrpc_syms.c Fri Dec 12 22:27:11 1997
@@ -62,7 +62,6 @@
/* RPC server stuff */
EXPORT_SYMBOL(svc_create);
-EXPORT_SYMBOL(svc_create_socket);
EXPORT_SYMBOL(svc_create_thread);
EXPORT_SYMBOL(svc_exit_thread);
EXPORT_SYMBOL(svc_destroy);
@@ -70,6 +69,7 @@
EXPORT_SYMBOL(svc_process);
EXPORT_SYMBOL(svc_recv);
EXPORT_SYMBOL(svc_wake_up);
+EXPORT_SYMBOL(svc_makesock);
/* RPC statistics */
#ifdef CONFIG_PROC_FS
--- linux-2.1.72/include/linux/sunrpc/svcsock.h.old Wed Dec 10 00:31:56 1997
+++ linux-2.1.72/include/linux/sunrpc/svcsock.h Fri Dec 12 22:25:53 1997
@@ -49,7 +49,7 @@
/*
* Function prototypes.
*/
-int svc_create_socket(struct svc_serv *, int, struct sockaddr_in *);
+int svc_makesock(struct svc_serv *, int, unsigned short);
void svc_delete_socket(struct svc_sock *);
int svc_recv(struct svc_serv *, struct svc_rqst *);
int svc_send(struct svc_rqst *);

--------------2767D1BF7A5CAF5C7D5559A6--

- Next message: Bill Hawes: "Re: Write to nfs fs gives I/O Error"
- Previous message: Eberhard Burr: "Re: Console handling (was: Re: Let's vote for PnP on 2.2)"