Commit c9f192bd authored by Kendrick M. Smith's avatar Kendrick M. Smith Committed by Linus Torvalds

[PATCH] kNFSd: NFSv4: new argument to nfsd_access()

NFSv4 defines a new field in the ACCESS response: a bitmap to indicate
which access bits requested by the client are "supported", i.e. meaningful
for the object in question.

This patch adds a new parameter @supported to nfsd_access(), so that
nfsd_access() can set the value of this bitmap.
parent b05942a3
...@@ -134,7 +134,7 @@ nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, ...@@ -134,7 +134,7 @@ nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
fh_copy(&resp->fh, &argp->fh); fh_copy(&resp->fh, &argp->fh);
resp->access = argp->access; resp->access = argp->access;
nfserr = nfsd_access(rqstp, &resp->fh, &resp->access); nfserr = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
RETURN_STATUS(nfserr); RETURN_STATUS(nfserr);
} }
......
...@@ -348,12 +348,12 @@ static struct accessmap nfs3_anyaccess[] = { ...@@ -348,12 +348,12 @@ static struct accessmap nfs3_anyaccess[] = {
}; };
int int
nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access) nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *supported)
{ {
struct accessmap *map; struct accessmap *map;
struct svc_export *export; struct svc_export *export;
struct dentry *dentry; struct dentry *dentry;
u32 query, result = 0; u32 query, result = 0, sresult = 0;
unsigned int error; unsigned int error;
error = fh_verify(rqstp, fhp, 0, MAY_NOP); error = fh_verify(rqstp, fhp, 0, MAY_NOP);
...@@ -375,6 +375,9 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access) ...@@ -375,6 +375,9 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access)
for (; map->access; map++) { for (; map->access; map++) {
if (map->access & query) { if (map->access & query) {
unsigned int err2; unsigned int err2;
sresult |= map->access;
err2 = nfsd_permission(export, dentry, map->how); err2 = nfsd_permission(export, dentry, map->how);
switch (err2) { switch (err2) {
case nfs_ok: case nfs_ok:
...@@ -395,6 +398,8 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access) ...@@ -395,6 +398,8 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access)
} }
} }
*access = result; *access = result;
if (supported)
*supported = sresult;
out: out:
return error; return error;
......
...@@ -86,7 +86,7 @@ int nfsd_create(struct svc_rqst *, struct svc_fh *, ...@@ -86,7 +86,7 @@ int nfsd_create(struct svc_rqst *, struct svc_fh *,
char *name, int len, struct iattr *attrs, char *name, int len, struct iattr *attrs,
int type, dev_t rdev, struct svc_fh *res); int type, dev_t rdev, struct svc_fh *res);
#ifdef CONFIG_NFSD_V3 #ifdef CONFIG_NFSD_V3
int nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *); int nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *);
int nfsd_create_v3(struct svc_rqst *, struct svc_fh *, int nfsd_create_v3(struct svc_rqst *, struct svc_fh *,
char *name, int len, struct iattr *attrs, char *name, int len, struct iattr *attrs,
struct svc_fh *res, int createmode, struct svc_fh *res, int createmode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment