Skip to content

Commit 22cf841

Browse files
author
J. Bruce Fields
committed
nfsd: apply umask on fs without ACL support
The server is failing to apply the umask when creating new objects on filesystems without ACL support. To reproduce this, you need to use NFSv4.2 and a client and server recent enough to support umask, and you need to export a filesystem that lacks ACL support (for example, ext4 with the "noacl" mount option). Filesystems with ACL support are expected to take care of the umask themselves (usually by calling posix_acl_create). For filesystems without ACL support, this is up to the caller of vfs_create(), vfs_mknod(), or vfs_mkdir(). Reported-by: Elliott Mitchell <[email protected]> Reported-by: Salvatore Bonaccorso <[email protected]> Tested-by: Salvatore Bonaccorso <[email protected]> Fixes: 47057ab ("nfsd: add support for the umask attribute") Cc: [email protected] Signed-off-by: J. Bruce Fields <[email protected]>
1 parent b3a9e3b commit 22cf841

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/nfsd/vfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,9 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,
12261226
iap->ia_mode = 0;
12271227
iap->ia_mode = (iap->ia_mode & S_IALLUGO) | type;
12281228

1229+
if (!IS_POSIXACL(dirp))
1230+
iap->ia_mode &= ~current_umask();
1231+
12291232
err = 0;
12301233
host_err = 0;
12311234
switch (type) {
@@ -1458,6 +1461,9 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
14581461
goto out;
14591462
}
14601463

1464+
if (!IS_POSIXACL(dirp))
1465+
iap->ia_mode &= ~current_umask();
1466+
14611467
host_err = vfs_create(dirp, dchild, iap->ia_mode, true);
14621468
if (host_err < 0) {
14631469
fh_drop_write(fhp);

0 commit comments

Comments
 (0)