2005-01-22 20:40:00

by Andreas Gruenbacher

[permalink] [raw]
Subject: [patch 2/13] Return -ENOSYS for RPC programs that are unavailable

The issuer of an RPC call should be able to tell the difference
between an I/O error and program unavailable / program version
unavailable / procedure unavailable. Return -ENOSYS for unavailable
RPCs instead of -EIO.

Only issue a program unavailable warning for program numbers other
than the one for nfsacl: Clients with nfsacl support are quite
common already; no need to clutter the syslog.

Signed-off-by: Andreas Gruenbacher <[email protected]>
Signed-off-by: Olaf Kirch <[email protected]>

Index: linux-2.6.11-rc2/include/linux/nfs.h
===================================================================
--- linux-2.6.11-rc2.orig/include/linux/nfs.h
+++ linux-2.6.11-rc2/include/linux/nfs.h
@@ -11,6 +11,7 @@
#include <linux/string.h>

#define NFS_PROGRAM 100003
+#define NFSACL_PROGRAM 100227
#define NFS_PORT 2049
#define NFS_MAXDATA 8192
#define NFS_MAXPATHLEN 1024
Index: linux-2.6.11-rc2/net/sunrpc/clnt.c
===================================================================
--- linux-2.6.11-rc2.orig/net/sunrpc/clnt.c
+++ linux-2.6.11-rc2/net/sunrpc/clnt.c
@@ -988,10 +988,12 @@ call_verify(struct rpc_task *task)
break;
case RPC_MISMATCH:
printk(KERN_WARNING "%s: RPC call version mismatch!\n", __FUNCTION__);
- goto out_eio;
+ error = -ENOSYS;
+ goto out_err;
default:
printk(KERN_WARNING "%s: RPC call rejected, unknown error: %x\n", __FUNCTION__, n);
- goto out_eio;
+ error = -ENOSYS;
+ goto out_err;
}
if (--len < 0)
goto out_overflow;
@@ -1041,23 +1043,28 @@ call_verify(struct rpc_task *task)
case RPC_SUCCESS:
return p;
case RPC_PROG_UNAVAIL:
- printk(KERN_WARNING "RPC: call_verify: program %u is unsupported by server %s\n",
+ if (task->tk_client->cl_prog != NFSACL_PROGRAM) {
+ printk(KERN_WARNING "RPC: call_verify: program %u is unsupported by server %s\n",
(unsigned int)task->tk_client->cl_prog,
task->tk_client->cl_server);
- goto out_eio;
+ }
+ error = -ENOSYS;
+ goto out_err;
case RPC_PROG_MISMATCH:
printk(KERN_WARNING "RPC: call_verify: program %u, version %u unsupported by server %s\n",
(unsigned int)task->tk_client->cl_prog,
(unsigned int)task->tk_client->cl_vers,
task->tk_client->cl_server);
- goto out_eio;
+ error = -ENOSYS;
+ goto out_err;
case RPC_PROC_UNAVAIL:
printk(KERN_WARNING "RPC: call_verify: proc %p unsupported by program %u, version %u on server %s\n",
task->tk_msg.rpc_proc,
task->tk_client->cl_prog,
task->tk_client->cl_vers,
task->tk_client->cl_server);
- goto out_eio;
+ error = -ENOSYS;
+ goto out_err;
case RPC_GARBAGE_ARGS:
dprintk("RPC: %4d %s: server saw garbage\n", task->tk_pid, __FUNCTION__);
break; /* retry */
@@ -1075,7 +1082,6 @@ out_retry:
return NULL;
}
printk(KERN_WARNING "RPC %s: retry failed, exit EIO\n", __FUNCTION__);
-out_eio:
error = -EIO;
out_err:
rpc_exit(task, error);

--
Andreas Gruenbacher <[email protected]>
SUSE Labs, SUSE LINUX PRODUCTS GMBH


2005-02-15 17:10:26

by Trond Myklebust

[permalink] [raw]
Subject: Re: [patch 2/13] Return -ENOSYS for RPC programs that are unavailable

No hacks in sunrpc, please: i.e. get rid of that NFSACL_PROGRAM
exception...
If you want to kill those warnings, please just convert them to
dprintks().

Also, why are you converting "unknown error" into ENOSYS?

Finally, it might make sense to distinguish between "program" and
"procedure" errors. How about converting that RPC_PROC_UNAVAIL error
into EOPNOTSUPP (like we already do in the NFS layer itself).

Cheers,
Trond

lau den 22.01.2005 Klokka 21:34 (+0100) skreiv Andreas Gruenbacher:
> vanlig tekstdokument vedlegg (patches.suse)
> The issuer of an RPC call should be able to tell the difference
> between an I/O error and program unavailable / program version
> unavailable / procedure unavailable. Return -ENOSYS for unavailable
> RPCs instead of -EIO.
>
> Only issue a program unavailable warning for program numbers other
> than the one for nfsacl: Clients with nfsacl support are quite
> common already; no need to clutter the syslog.
>
> Signed-off-by: Andreas Gruenbacher <[email protected]>
> Signed-off-by: Olaf Kirch <[email protected]>
>
> Index: linux-2.6.11-rc2/include/linux/nfs.h
> ===================================================================
> --- linux-2.6.11-rc2.orig/include/linux/nfs.h
> +++ linux-2.6.11-rc2/include/linux/nfs.h
> @@ -11,6 +11,7 @@
> #include <linux/string.h>
>
> #define NFS_PROGRAM 100003
> +#define NFSACL_PROGRAM 100227
> #define NFS_PORT 2049
> #define NFS_MAXDATA 8192
> #define NFS_MAXPATHLEN 1024
> Index: linux-2.6.11-rc2/net/sunrpc/clnt.c
> ===================================================================
> --- linux-2.6.11-rc2.orig/net/sunrpc/clnt.c
> +++ linux-2.6.11-rc2/net/sunrpc/clnt.c
> @@ -988,10 +988,12 @@ call_verify(struct rpc_task *task)
> break;
> case RPC_MISMATCH:
> printk(KERN_WARNING "%s: RPC call version mismatch!\n", __FUNCTION__);
> - goto out_eio;
> + error = -ENOSYS;
> + goto out_err;
> default:
> printk(KERN_WARNING "%s: RPC call rejected, unknown error: %x\n", __FUNCTION__, n);
> - goto out_eio;
> + error = -ENOSYS;
> + goto out_err;
> }
> if (--len < 0)
> goto out_overflow;
> @@ -1041,23 +1043,28 @@ call_verify(struct rpc_task *task)
> case RPC_SUCCESS:
> return p;
> case RPC_PROG_UNAVAIL:
> - printk(KERN_WARNING "RPC: call_verify: program %u is unsupported by server %s\n",
> + if (task->tk_client->cl_prog != NFSACL_PROGRAM) {
> + printk(KERN_WARNING "RPC: call_verify: program %u is unsupported by server %s\n",
> (unsigned int)task->tk_client->cl_prog,
> task->tk_client->cl_server);
> - goto out_eio;
> + }
> + error = -ENOSYS;
> + goto out_err;
> case RPC_PROG_MISMATCH:
> printk(KERN_WARNING "RPC: call_verify: program %u, version %u unsupported by server %s\n",
> (unsigned int)task->tk_client->cl_prog,
> (unsigned int)task->tk_client->cl_vers,
> task->tk_client->cl_server);
> - goto out_eio;
> + error = -ENOSYS;
> + goto out_err;
> case RPC_PROC_UNAVAIL:
> printk(KERN_WARNING "RPC: call_verify: proc %p unsupported by program %u, version %u on server %s\n",
> task->tk_msg.rpc_proc,
> task->tk_client->cl_prog,
> task->tk_client->cl_vers,
> task->tk_client->cl_server);
> - goto out_eio;
> + error = -ENOSYS;
> + goto out_err;
> case RPC_GARBAGE_ARGS:
> dprintk("RPC: %4d %s: server saw garbage\n", task->tk_pid, __FUNCTION__);
> break; /* retry */
> @@ -1075,7 +1082,6 @@ out_retry:
> return NULL;
> }
> printk(KERN_WARNING "RPC %s: retry failed, exit EIO\n", __FUNCTION__);
> -out_eio:
> error = -EIO;
> out_err:
> rpc_exit(task, error);
>
> --
> Andreas Gruenbacher <[email protected]>
> SUSE Labs, SUSE LINUX PRODUCTS GMBH
>
--
Trond Myklebust <[email protected]>

2005-02-16 15:32:55

by Andreas Gruenbacher

[permalink] [raw]
Subject: Re: [patch 2/13] Return -ENOSYS for RPC programs that are unavailable

First, thanks for your feedback.

On Tue, 2005-02-15 at 18:04, Trond Myklebust wrote:
> No hacks in sunrpc, please: i.e. get rid of that NFSACL_PROGRAM
> exception...
> If you want to kill those warnings, please just convert them to
> dprintks().

Fine with me.

> Also, why are you converting "unknown error" into ENOSYS?

That's a bug.

> Finally, it might make sense to distinguish between "program" and
> "procedure" errors. How about converting that RPC_PROC_UNAVAIL error
> into EOPNOTSUPP (like we already do in the NFS layer itself).

Okay, that shouldn't hurt. Fixes attached.

Cheers,
--
Andreas Gruenbacher <[email protected]>
SUSE Labs, SUSE LINUX GMBH


Attachments:
nfsacl-return-enosys-for-rpc-programs-that-are-unavailable-fix.patch (1.43 kB)
nfsacl-client-side-of-nfsacl-fix2.patch (805.00 B)
Download all attachments