mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruen@suse.de>
To: linux-kernel@vger.kernel.org, Neil Brown <neilb@cse.unsw.edu.au>,
	Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Olaf Kirch <okir@suse.de>,
	"Andries E. Brouwer" <Andries.Brouwer@cwi.nl>,
	Andrew Morton <akpm@osdl.org>
Subject: [patch 03/16] Return -ENOSYS for RPC programs that are unavailable
Date: Sun, 27 Feb 2005 16:22:46 +0100	[thread overview]
Message-ID: <20050227152349.852124000@blunzn.suse.de> (raw)
In-Reply-To: <20050227152243.083308000@blunzn.suse.de>

[-- Attachment #1: nfsacl-return-enosys-for-rpc-programs-that-are-unavailable.patch --]
[-- Type: text/plain, Size: 2580 bytes --]

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 <agruen@suse.de>

Index: linux-2.6.11-rc5/net/sunrpc/clnt.c
===================================================================
--- linux-2.6.11-rc5.orig/net/sunrpc/clnt.c
+++ linux-2.6.11-rc5/net/sunrpc/clnt.c
@@ -970,6 +970,7 @@ call_verify(struct rpc_task *task)
 	struct kvec *iov = &task->tk_rqstp->rq_rcv_buf.head[0];
 	int len = task->tk_rqstp->rq_rcv_buf.len >> 2;
 	u32	*p = iov->iov_base, n;
+	int error = -EACCES;
 
 	if ((len -= 3) < 0)
 		goto garbage;
@@ -980,8 +981,6 @@ call_verify(struct rpc_task *task)
 		goto garbage;
 	}
 	if ((n = ntohl(*p++)) != RPC_MSG_ACCEPTED) {
-		int	error = -EACCES;
-
 		if (--len < 0)
 			goto garbage;
 		if ((n = ntohl(*p++)) != RPC_AUTH_ERROR) {
@@ -1035,23 +1034,26 @@ 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",
-				(unsigned int)task->tk_client->cl_prog,
-				task->tk_client->cl_server);
-		goto out_eio;
+		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;
 	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 = -EOPNOTSUPP;
+		goto out_err;
 	case RPC_GARBAGE_ARGS:
 		break;			/* retry */
 	default:
@@ -1069,7 +1071,8 @@ garbage:
 		return NULL;
 	}
 	printk(KERN_WARNING "RPC: garbage, exit EIO\n");
-out_eio:
-	rpc_exit(task, -EIO);
+	error = -EIO;
+out_err:
+	rpc_exit(task, error);
 	return NULL;
 }

--
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX PRODUCTS GMBH


  parent reply	other threads:[~2005-02-27 15:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-27 15:22 [patch 00/16] NFSACL protocol extension for NFSv3 Andreas Gruenbacher
2005-02-27 15:22 ` [patch 01/16] acl kconfig cleanup Andreas Gruenbacher
2005-02-27 15:22 ` [patch 02/16] Qsort Andreas Gruenbacher
2005-02-27 15:22 ` Andreas Gruenbacher [this message]
2005-02-27 15:22 ` [patch 04/16] Add missing -EOPNOTSUPP => NFS3ERR_NOTSUPP mapping in nfsd Andreas Gruenbacher
2005-02-27 15:22 ` [patch 05/16] Allow multiple programs to listen on the same port Andreas Gruenbacher
2005-02-27 15:22 ` [patch 06/16] Allow multiple programs to share the same transport Andreas Gruenbacher
2005-02-27 15:22 ` [patch 07/16] Lazy RPC receive buffer allocation Andreas Gruenbacher
2005-02-27 15:22 ` [patch 08/16] Encode and decode arbitrary XDR arrays Andreas Gruenbacher
2005-02-27 15:22 ` [patch 09/16] Add noacl nfs mount option Andreas Gruenbacher
2005-02-27 15:22 ` [patch 10/16] Infrastructure and server side of nfsacl Andreas Gruenbacher
2005-02-27 22:53   ` Christoph Hellwig
2005-02-27 15:22 ` [patch 11/16] Solaris nfsacl workaround Andreas Gruenbacher
2005-03-09 23:56   ` Trond Myklebust
2005-03-10  8:16     ` Andreas Gruenbacher
2005-02-27 15:22 ` [patch 12/16] nfs mknod cleanup Andreas Gruenbacher
2005-02-27 15:22 ` [patch 13/16] nfs mkdir cleanup Andreas Gruenbacher
2005-02-27 15:22 ` [patch 14/16] Client side of nfsacl Andreas Gruenbacher
2005-02-27 15:22 ` [patch 15/16] ACL umask handling workaround in nfs client Andreas Gruenbacher
2005-02-27 15:22 ` [patch 16/16] Cache acls on the nfs client side Andreas Gruenbacher
2005-02-27 16:35 ` [patch 00/16] NFSACL protocol extension for NFSv3 Andreas Gruenbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050227152349.852124000@blunzn.suse.de \
    --to=agruen@suse.de \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    --cc=okir@suse.de \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®