From 3333e8aa5c9e0cda56806f8f3cb2fb27159a3bc3 Mon Sep 17 00:00:00 2001 From: yamt Date: Fri, 30 Jun 2006 09:55:34 +0000 Subject: [PATCH] fix handling of NFSERR_NOTSUPP and NFSERR_BAD_COOKIE, which have been broken since nfs_socket.c rev.1.115. --- sys/nfs/nfs_bio.c | 15 ++++++++++----- sys/nfs/nfs_vnops.c | 9 ++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index 7bf9ce69ec12..178180a64478 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_bio.c,v 1.143 2006/05/14 21:32:21 elad Exp $ */ +/* $NetBSD: nfs_bio.c,v 1.144 2006/06/30 09:55:34 yamt Exp $ */ /* * Copyright (c) 1989, 1993 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.143 2006/05/14 21:32:21 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.144 2006/06/30 09:55:34 yamt Exp $"); #include "opt_nfs.h" #include "opt_ddb.h" @@ -286,10 +286,12 @@ diragain: */ nfs_putdircache(np, ndp); brelse(bp); - if (error == NFSERR_BAD_COOKIE) { + /* + * nfs_request maps NFSERR_BAD_COOKIE to EINVAL. + */ + if (error == EINVAL) { /* NFSERR_BAD_COOKIE */ nfs_invaldircache(vp, 0); nfs_vinvalbuf(vp, 0, cred, l, 1); - error = EINVAL; } return (error); } @@ -984,7 +986,10 @@ nfs_doio_read(bp, uiop) if (nmp->nm_flag & NFSMNT_RDIRPLUS) { error = nfs_readdirplusrpc(vp, uiop, curlwp->l_proc->p_cred); - if (error == NFSERR_NOTSUPP) + /* + * nfs_request maps NFSERR_NOTSUPP to ENOTSUP. + */ + if (error == ENOTSUP) nmp->nm_flag &= ~NFSMNT_RDIRPLUS; } #else diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index dafc3f8cd05f..f0b4f0c7c2de 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_vnops.c,v 1.237 2006/06/07 22:34:18 kardel Exp $ */ +/* $NetBSD: nfs_vnops.c,v 1.238 2006/06/30 09:55:34 yamt Exp $ */ /* * Copyright (c) 1989, 1993 @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.237 2006/06/07 22:34:18 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.238 2006/06/30 09:55:34 yamt Exp $"); #include "opt_inet.h" #include "opt_nfs.h" @@ -1775,7 +1775,10 @@ again: #endif nfsm_reqdone; if (error) { - if (v3 && (fmode & O_EXCL) && error == NFSERR_NOTSUPP) { + /* + * nfs_request maps NFSERR_NOTSUPP to ENOTSUP. + */ + if (v3 && (fmode & O_EXCL) && error == ENOTSUP) { fmode &= ~O_EXCL; goto again; }