[PATCH 1/5] pnfsd: fix NFS4ERR_BADIOMODE in layoutget

andros
2010-02-05T17:09:36Z

From: Andy Adamson <andros@netapp.com>

If an invalid iomode, or an iomode of LAYOUTIOMODE4_ANY is specified, the
metadata server MUST return NFS4ERR_BADIOMODE.

Signed-off-by: Andy Adamson <andros@netapp.com>
---
fs/nfsd/nfs4proc.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 769628f..575e1b6 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1114,21 +1114,14 @@ nfsd4_layoutget(struct svc_rqst *rqstp,
if (status)
goto out;

- status = nfserr_inval;
+ status = nfserr_badiomode;
if (lgp->lg_seg.iomode != IOMODE_READ &&
- lgp->lg_seg.iomode != IOMODE_RW &&
- lgp->lg_seg.iomode != IOMODE_ANY) {
+ lgp->lg_seg.iomode != IOMODE_RW) {
dprintk("pNFS %s: invalid iomode %d\n", __func__,
lgp->lg_seg.iomode);
goto out;
}

- status = nfserr_badiomode;
- if (lgp->lg_seg.iomode == IOMODE_ANY) {
- dprintk("pNFS %s: IOMODE_ANY is not allowed\n", __func__);
- goto out;
- }
-
/* Set up arguments so layout can be retrieved at encode time */
lgp->lg_fhp = current_fh;
copy_clientid((clientid_t *)&lgp->lg_seg.clientid, cstate->session);
--
1.6.6