aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorTomohiro Kusumi <[email protected]>2019-12-14 08:02:23 +0900
committerBrian Behlendorf <[email protected]>2019-12-13 15:02:23 -0800
commitddb4e69db5eb0ed741dc4e32714af3e0f054086c (patch)
tree36c28e36874c8e010fd3d6a375f862902018433f /module
parentc317c8c811873c4a0fefd41bd317bf266a29f966 (diff)
Don't fail to apply umask for O_TMPFILE files
Apply umask to `mode` which will eventually be applied to inode. This is needed since VFS doesn't apply umask for O_TMPFILE files. (Note that zpl_init_acl() applies `ip->i_mode &= ~current_umask();` only when POSIX ACL is used.) Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Tomohiro Kusumi <[email protected]> Closes #8997 Closes #8998
Diffstat (limited to 'module')
-rw-r--r--module/os/linux/zfs/zpl_inode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/module/os/linux/zfs/zpl_inode.c b/module/os/linux/zfs/zpl_inode.c
index 264c5d2b1..e1c6ce7b7 100644
--- a/module/os/linux/zfs/zpl_inode.c
+++ b/module/os/linux/zfs/zpl_inode.c
@@ -218,6 +218,12 @@ zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
crhold(cr);
vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
+ /*
+ * The VFS does not apply the umask, therefore it is applied here
+ * when POSIX ACLs are not enabled.
+ */
+ if (!IS_POSIXACL(dir))
+ mode &= ~current_umask();
zpl_vap_init(vap, dir, mode, cr);
cookie = spl_fstrans_mark();