From f19cf1d94592576aa29447e2a0b768b70f872688 Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Sun, 18 Mar 2012 22:44:50 -0400 Subject: [PATCH] --- yaml --- r: 297458 b: refs/heads/master c: 06effdbb49af5f6c7d20affaec74603914acc768 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/nfsd/vfs.c | 15 +++++++++++++-- trunk/fs/nfsd/vfs.h | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index be551254ef49..76c404107ef0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 999448a8c0202d8c41711c92385323520644527b +refs/heads/master: 06effdbb49af5f6c7d20affaec74603914acc768 diff --git a/trunk/fs/nfsd/vfs.c b/trunk/fs/nfsd/vfs.c index a6db4cb874d5..7423d712eb8c 100644 --- a/trunk/fs/nfsd/vfs.c +++ b/trunk/fs/nfsd/vfs.c @@ -796,9 +796,15 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, flags, current_cred()); if (IS_ERR(*filp)) host_err = PTR_ERR(*filp); - else + else { host_err = ima_file_check(*filp, may_flags); + if (may_flags & NFSD_MAY_64BIT_COOKIE) + (*filp)->f_mode |= FMODE_64BITHASH; + else + (*filp)->f_mode |= FMODE_32BITHASH; + } + out_nfserr: err = nfserrno(host_err); out: @@ -2022,8 +2028,13 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, __be32 err; struct file *file; loff_t offset = *offsetp; + int may_flags = NFSD_MAY_READ; + + /* NFSv2 only supports 32 bit cookies */ + if (rqstp->rq_vers > 2) + may_flags |= NFSD_MAY_64BIT_COOKIE; - err = nfsd_open(rqstp, fhp, S_IFDIR, NFSD_MAY_READ, &file); + err = nfsd_open(rqstp, fhp, S_IFDIR, may_flags, &file); if (err) goto out; diff --git a/trunk/fs/nfsd/vfs.h b/trunk/fs/nfsd/vfs.h index 1dcd238e11a0..ec0611b2b738 100644 --- a/trunk/fs/nfsd/vfs.h +++ b/trunk/fs/nfsd/vfs.h @@ -27,6 +27,8 @@ #define NFSD_MAY_BYPASS_GSS 0x400 #define NFSD_MAY_READ_IF_EXEC 0x800 +#define NFSD_MAY_64BIT_COOKIE 0x1000 /* 64 bit readdir cookies for >= NFSv3 */ + #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC)