[PATCH 2/2] nfs: translate ESERVERFAULT to ENOENT in decode_putrootfh

Benny Halevy bhalevy at panasas.com
Sun Jan 20 11:23:53 EST 2008


The server may return NFS4ERR_SERVERFAULT to PUTROOTFH.

If passed upstream verbatim, the mount command doesn't recognize it
and prints the following:

mount.nfs4: Unknown error 526

With the translation to ENOENT, the status, as returned by the mount
system call, is translated to a more sensible code:

mount.nfs4: localhost:/ failed, reason given by server: No such file or directory

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/nfs4xdr.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 51dd380..799b915 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -3441,7 +3441,12 @@ static int decode_putfh(struct xdr_stream *xdr)
 
 static int decode_putrootfh(struct xdr_stream *xdr)
 {
-	return decode_op_hdr(xdr, OP_PUTROOTFH);
+	int status = decode_op_hdr(xdr, OP_PUTROOTFH);
+
+	if (status == -ESERVERFAULT)
+		status = -ENOENT;
+
+	return status;
 }
 
 static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_readres *res)
-- 
1.5.3.3



More information about the NFSv4 mailing list