summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4proc.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2016-01-12 20:24:14 +0100
committerJ. Bruce Fields <bfields@redhat.com>2016-12-15 20:42:48 -0500
commit47057abde515155a4fee53038e7772d6b387e0aa (patch)
treea908af6dc69beb0f1d2cc6745a10a6a9f9bc4225 /fs/nfsd/nfs4proc.c
parent3eb15f2828464791f68b341ce87183012c509fc6 (diff)
downloadlinux-stable-47057abde515155a4fee53038e7772d6b387e0aa.tar.gz
linux-stable-47057abde515155a4fee53038e7772d6b387e0aa.tar.bz2
linux-stable-47057abde515155a4fee53038e7772d6b387e0aa.zip
nfsd: add support for the umask attribute
Clients can set the umask attribute when creating files to cause the server to apply it always except when inheriting permissions from the parent directory. That way, the new files will end up with the same permissions as files created locally. See https://tools.ietf.org/html/draft-ietf-nfsv4-umask-02 for more details. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r--fs/nfsd/nfs4proc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index e901cf124e9f..74a6e573e061 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -102,6 +102,9 @@ check_attr_support(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
return nfserr_attrnotsupp;
if (writable && !bmval_is_subset(bmval, writable))
return nfserr_inval;
+ if (writable && (bmval[2] & FATTR4_WORD2_MODE_UMASK) &&
+ (bmval[1] & FATTR4_WORD1_MODE))
+ return nfserr_inval;
return nfs_ok;
}