diff options
author | Jeff Layton <jlayton@kernel.org> | 2023-09-12 03:25:50 +0300 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2023-10-19 12:02:47 +0300 |
commit | 5aa8fd9cea2ee0d42c5d92c5eacf0a14bbc4c293 (patch) | |
tree | 055147b2649fad285c863547c41cba7d766761bc /fs/namei.c | |
parent | 84d2b696236c63836011f04d13d3f09ed47fa560 (diff) | |
download | linux-5aa8fd9cea2ee0d42c5d92c5eacf0a14bbc4c293.tar.xz |
fs: add a new SB_I_NOUMASK flag
SB_POSIXACL must be set when a filesystem supports POSIX ACLs, but NFSv4
also sets this flag to prevent the VFS from applying the umask on
newly-created files. NFSv4 doesn't support POSIX ACLs however, which
causes confusion when other subsystems try to test for them.
Add a new SB_I_NOUMASK flag that allows filesystems to opt-in to umask
stripping without advertising support for POSIX ACLs. Set the new flag
on NFSv4 instead of SB_POSIXACL.
Also, move mode_strip_umask to namei.h and convert init_mknod and
init_mkdir to use it.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Message-Id: <20230911-acl-fix-v3-1-b25315333f6c@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/fs/namei.c b/fs/namei.c index 567ee547492b..94b27370f468 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3104,25 +3104,6 @@ void unlock_rename(struct dentry *p1, struct dentry *p2) EXPORT_SYMBOL(unlock_rename); /** - * mode_strip_umask - handle vfs umask stripping - * @dir: parent directory of the new inode - * @mode: mode of the new inode to be created in @dir - * - * Umask stripping depends on whether or not the filesystem supports POSIX - * ACLs. If the filesystem doesn't support it umask stripping is done directly - * in here. If the filesystem does support POSIX ACLs umask stripping is - * deferred until the filesystem calls posix_acl_create(). - * - * Returns: mode - */ -static inline umode_t mode_strip_umask(const struct inode *dir, umode_t mode) -{ - if (!IS_POSIXACL(dir)) - mode &= ~current_umask(); - return mode; -} - -/** * vfs_prepare_mode - prepare the mode to be used for a new inode * @idmap: idmap of the mount the inode was found from * @dir: parent directory of the new inode |