From: Christian Brauner <brauner@kernel.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna@kernel.org>,
Ondrej Valousek <ondrej.valousek.xm@renesas.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2] fs: add a new SB_NOUMASK flag
Date: Mon, 11 Sep 2023 15:42:46 +0200 [thread overview]
Message-ID: <20230911-blasen-zieren-4d65d9bc245e@brauner> (raw)
In-Reply-To: <20230910-acl-fix-v2-1-38d6caa81419@kernel.org>
On Sun, Sep 10, 2023 at 03:30:48PM -0400, Jeff Layton wrote:
> 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.
>
> Split the umask-stripping opt-out into a separate SB_NOUMASK flag, and
> have NFSv4 set that instead of SB_POSIXACL. Fix the appropriate places
> in the VFS to check for that flag (in addition to SB_POSIXACL) when
> stripping the umask.
Oh, I see you only raised SB_POSIXACL to avoid umask stripping. That's a
bit weird indeed. Hm, since this is an internal, non-user changeable
flag I think it might be better in s_iflags as SB_I_NOUMASK? Also allows
us to avoid wasting an s_flags bit.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> Yet another approach to fixing this issue. I think this way is probably
> the best, since makes the purpose of these flags clearer, and stops NFS
> from relying on SB_POSIXACL to avoid umask stripping.
> ---
> Changes in v2:
> - new approach: add a new SB_NOUMASK flag that NFSv4 can use instead of
> SB_POSIXACL
> - Link to v1: https://lore.kernel.org/r/20230908-acl-fix-v1-1-1e6b76c8dcc8@kernel.org
> ---
> fs/init.c | 4 ++--
> fs/namei.c | 2 +-
> fs/nfs/super.c | 2 +-
> include/linux/fs.h | 4 +++-
> 4 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/fs/init.c b/fs/init.c
> index 9684406a8416..157404bb7d19 100644
> --- a/fs/init.c
> +++ b/fs/init.c
> @@ -153,7 +153,7 @@ int __init init_mknod(const char *filename, umode_t mode, unsigned int dev)
> if (IS_ERR(dentry))
> return PTR_ERR(dentry);
>
> - if (!IS_POSIXACL(path.dentry->d_inode))
> + if (!IS_NOUMASK(path.dentry->d_inode))
> mode &= ~current_umask();
> error = security_path_mknod(&path, dentry, mode, dev);
> if (!error)
> @@ -229,7 +229,7 @@ int __init init_mkdir(const char *pathname, umode_t mode)
> dentry = kern_path_create(AT_FDCWD, pathname, &path, LOOKUP_DIRECTORY);
> if (IS_ERR(dentry))
> return PTR_ERR(dentry);
> - if (!IS_POSIXACL(path.dentry->d_inode))
> + if (!IS_NOUMASK(path.dentry->d_inode))
> mode &= ~current_umask();
Could you please just convert them over to mode_strip_umask()?
Seems I forgot these two places back then.
prev parent reply other threads:[~2023-09-11 21:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-10 19:30 [PATCH v2] fs: add a new SB_NOUMASK flag Jeff Layton
2023-09-11 13:42 ` Christian Brauner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230911-blasen-zieren-4d65d9bc245e@brauner \
--to=brauner@kernel.org \
--cc=anna@kernel.org \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=ondrej.valousek.xm@renesas.com \
--cc=trond.myklebust@hammerspace.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).