linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
To: Christian Brauner <brauner@kernel.org>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	"david@fromorbit.com" <david@fromorbit.com>,
	"djwong@kernel.org" <djwong@kernel.org>,
	"jlayton@kernel.org" <jlayton@kernel.org>,
	"ntfs3@lists.linux.dev" <ntfs3@lists.linux.dev>,
	"chao@kernel.org" <chao@kernel.org>,
	"linux-f2fs-devel@lists.sourceforge.net" 
	<linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [PATCH v4 1/8] fs: move sgid strip operation from inode_init_owner into inode_sgid_strip
Date: Wed, 20 Apr 2022 01:27:39 +0000	[thread overview]
Message-ID: <625F6FE6.4010305@fujitsu.com> (raw)
In-Reply-To: <20220419140508.b6c4uit3u5hmdql4@wittgenstein>

on 2022/4/19 22:05, Christian Brauner wrote:
> On Tue, Apr 19, 2022 at 07:47:07PM +0800, Yang Xu wrote:
>> This has no functional change. Just create and export inode_sgid_strip api for
>> the subsequent patch. This function is used to strip S_ISGID mode when init
>> a new inode.
>>
>> Acked-by: Christian Brauner (Microsoft)<brauner@kernel.org>
>> Signed-off-by: Yang Xu<xuyang2018.jy@fujitsu.com>
>> ---
>>   fs/inode.c         | 22 ++++++++++++++++++----
>>   include/linux/fs.h |  3 ++-
>>   2 files changed, 20 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/inode.c b/fs/inode.c
>> index 9d9b422504d1..3215e61a0021 100644
>> --- a/fs/inode.c
>> +++ b/fs/inode.c
>> @@ -2246,10 +2246,8 @@ void inode_init_owner(struct user_namespace *mnt_userns, struct inode *inode,
>>   		/* Directories are special, and always inherit S_ISGID */
>>   		if (S_ISDIR(mode))
>>   			mode |= S_ISGID;
>> -		else if ((mode&  (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)&&
>> -			 !in_group_p(i_gid_into_mnt(mnt_userns, dir))&&
>> -			 !capable_wrt_inode_uidgid(mnt_userns, dir, CAP_FSETID))
>> -			mode&= ~S_ISGID;
>> +		else
>> +			inode_sgid_strip(mnt_userns, dir,&mode);
>>   	} else
>>   		inode_fsgid_set(inode, mnt_userns);
>>   	inode->i_mode = mode;
>> @@ -2405,3 +2403,19 @@ struct timespec64 current_time(struct inode *inode)
>>   	return timestamp_truncate(now, inode);
>>   }
>>   EXPORT_SYMBOL(current_time);
>> +
>> +void inode_sgid_strip(struct user_namespace *mnt_userns,
>> +		      const struct inode *dir, umode_t *mode)
>> +{
>
> I think with Willy agreeing in an earlier version with me and you
> needing to resend anyway I'd say have this return umode_t instead of
> passing a pointer.

IMO, I am fine with your and Willy way. But I need a reason otherwise
I can't convince myself why not use mode pointer directly.

I have asked you and Willy before why return umode_t value is better, 
why not modify mode pointer directly? Since we have use mode as 
argument, why not modify mode pointer directly in function?

Also the function name(inode_sgid_strip and prepare_mode) has  expressed 
their function clearly.



  reply	other threads:[~2022-04-20  1:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 11:47 [PATCH v4 1/8] fs: move sgid strip operation from inode_init_owner into inode_sgid_strip Yang Xu
2022-04-19 11:47 ` [PATCH v4 2/8] fs: Add missing umask strip in vfs_tmpfile Yang Xu
2022-04-19 11:47 ` [PATCH v4 3/8] xfs: only call posix_acl_create under CONFIG_XFS_POSIX_ACL Yang Xu
2022-04-19 13:53   ` Christian Brauner
2022-04-20  1:12     ` xuyang2018.jy
2022-04-20  4:49   ` Christoph Hellwig
2022-04-19 11:47 ` [PATCH v4 4/8] NFSv3: only do posix_acl_create under CONFIG_NFS_V3_ACL Yang Xu
2022-04-19 13:59   ` Christian Brauner
2022-04-19 14:11     ` Trond Myklebust
2022-04-20  1:12       ` xuyang2018.jy
2022-04-19 11:47 ` [PATCH v4 5/8] f2fs: Remove useless NULL assign value for acl and default_acl Yang Xu
2022-04-19 14:02   ` Christian Brauner
2022-04-20  1:14     ` xuyang2018.jy
2022-04-19 11:47 ` [PATCH v4 6/8] ntfs3: Use the same order for acl pointer check in ntfs_init_acl Yang Xu
2022-04-19 14:03   ` Christian Brauner
2022-04-20  1:15     ` xuyang2018.jy
2022-04-19 11:47 ` [PATCH v4 7/8] fs: strip file's S_ISGID mode on vfs instead of on underlying filesystem Yang Xu
2022-04-19 14:09   ` Christian Brauner
2022-04-20  1:16     ` xuyang2018.jy
2022-04-19 11:47 ` [PATCH v4 8/8] ceph: Remove S_ISGID clear code in ceph_finish_async_create Yang Xu
2022-04-19 14:05 ` [PATCH v4 1/8] fs: move sgid strip operation from inode_init_owner into inode_sgid_strip Christian Brauner
2022-04-20  1:27   ` xuyang2018.jy [this message]
2022-04-20 21:52     ` Dave Chinner
2022-04-21  1:11       ` xuyang2018.jy

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=625F6FE6.4010305@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --cc=brauner@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=chao@kernel.org \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --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).