Re: [patch 2/13] Return -ENOSYS for RPC programs that areunavailable

From: Andreas Gruenbacher
Date: Wed Feb 16 2005 - 10:34:17 EST


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 <agruen@xxxxxxx>
SUSE Labs, SUSE LINUX GMBH
Index: linux-2.6.11-rc3/net/sunrpc/clnt.c
===================================================================
--- linux-2.6.11-rc3.orig/net/sunrpc/clnt.c
+++ linux-2.6.11-rc3/net/sunrpc/clnt.c
@@ -988,11 +988,11 @@ call_verify(struct rpc_task *task)
break;
case RPC_MISMATCH:
printk(KERN_WARNING "%s: RPC call version mismatch!\n", __FUNCTION__);
- error = -ENOSYS;
+ error = -EIO;
goto out_err;
default:
printk(KERN_WARNING "%s: RPC call rejected, unknown error: %x\n", __FUNCTION__, n);
- error = -ENOSYS;
+ error = -EIO;
goto out_err;
}
if (--len < 0)
@@ -1043,10 +1043,9 @@ call_verify(struct rpc_task *task)
case RPC_SUCCESS:
return p;
case RPC_PROG_UNAVAIL:
- 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);
+ dprintk(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);
}
error = -ENOSYS;
goto out_err;
@@ -1063,7 +1062,7 @@ call_verify(struct rpc_task *task)
task->tk_client->cl_prog,
task->tk_client->cl_vers,
task->tk_client->cl_server);
- error = -ENOSYS;
+ error = -EOPNOTSUPP;
goto out_err;
case RPC_GARBAGE_ARGS:
dprintk("RPC: %4d %s: server saw garbage\n", task->tk_pid, __FUNCTION__);
Index: linux-2.6.11-rc3/fs/nfs/nfs3proc.c
===================================================================
--- linux-2.6.11-rc3.orig/fs/nfs/nfs3proc.c
+++ linux-2.6.11-rc3/fs/nfs/nfs3proc.c
@@ -760,7 +760,7 @@ nfs3_proc_getacl(struct inode *inode, in
__free_page(args.pages[count]);

if (status) {
- if (status == -ENOSYS) {
+ if (status == -ENOSYS || status == -EOPNOTSUPP) {
dprintk("NFS_ACL extension not supported; disabling\n");
server->flags &= ~NFSACL;
status = -EOPNOTSUPP;
@@ -845,7 +845,7 @@ nfs3_proc_setacls(struct inode *inode, s
__free_page(args.pages[count]);

if (status) {
- if (status == -ENOSYS) {
+ if (status == -ENOSYS || status == -EOPNOTSUPP) {
dprintk("NFS_ACL SETACL RPC not supported"
"(will not retry)\n");
server->flags &= ~NFSACL;