Skip to content

Commit

Permalink
Don't fail to apply umask for O_TMPFILE files
Browse files Browse the repository at this point in the history
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.)

Signed-off-by: Tomohiro Kusumi <[email protected]>
  • Loading branch information
kusumi committed Jul 9, 2019
1 parent 1d20b76 commit a14d19d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions module/zfs/zpl_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ zpl_tmpfile(struct inode *dir, struct dentry *dentry, zpl_umode_t mode)

crhold(cr);
vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
/*
* The VFS does not apply the umask to the provided mode as of 5.2.
* Therefore, it must be applied at the filesystem layer.
*/
mode &= ~current_umask();
zpl_vap_init(vap, dir, mode, cr);

cookie = spl_fstrans_mark();
Expand Down

0 comments on commit a14d19d

Please sign in to comment.