All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] ntfs3: Use the same order for acl pointer check in ntfs_init_acl
@ 2022-04-20  8:48 Yang Xu
  2022-04-20 17:43 ` Kari Argillander
  2022-06-09 16:22 ` Konstantin Komarov
  0 siblings, 2 replies; 6+ messages in thread
From: Yang Xu @ 2022-04-20  8:48 UTC (permalink / raw)
  To: almaz.alexandrovich; +Cc: ntfs3, Yang Xu

Like ext4 and other use ${fs}_init_acl filesystem, they all used the following
style

       error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
       if (error)
                return error;

        if (default_acl) {
                error = __ext4_set_acl(handle, inode, ACL_TYPE_DEFAULT,
                                       default_acl, XATTR_CREATE);
                posix_acl_release(default_acl);
        } else {
                inode->i_default_acl = NULL;
        }
        if (acl) {
                if (!error)
                        error = __ext4_set_acl(handle, inode, ACL_TYPE_ACCESS,
                                               acl, XATTR_CREATE);
                posix_acl_release(acl);
        } else {
                inode->i_acl = NULL;
        }
	...

So for the readability and unity of the code, adjust this order.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 fs/ntfs3/xattr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index afd0ddad826f..64cefa869a61 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -642,13 +642,13 @@ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
 		inode->i_default_acl = NULL;
 	}
 
-	if (!acl)
-		inode->i_acl = NULL;
-	else {
+	if (acl) {
 		if (!err)
 			err = ntfs_set_acl_ex(mnt_userns, inode, acl,
 					      ACL_TYPE_ACCESS);
 		posix_acl_release(acl);
+	} else {
+		inode->i_acl = NULL;
 	}
 
 	return err;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RFC] ntfs3: Use the same order for acl pointer check in ntfs_init_acl
  2022-04-20  8:48 [RFC] ntfs3: Use the same order for acl pointer check in ntfs_init_acl Yang Xu
@ 2022-04-20 17:43 ` Kari Argillander
  2022-04-21  1:57   ` xuyang2018.jy
  2022-06-09 16:22 ` Konstantin Komarov
  1 sibling, 1 reply; 6+ messages in thread
From: Kari Argillander @ 2022-04-20 17:43 UTC (permalink / raw)
  To: Yang Xu, almaz.alexandrovich; +Cc: ntfs3

I do not understand why this RFC and not a patch.

On 20.4.2022 11.48, Yang Xu wrote:
> Like ext4 and other use ${fs}_init_acl filesystem, they all used the following
> style
> 
>         error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
>         if (error)
>                  return error;
> 
>          if (default_acl) {
>                  error = __ext4_set_acl(handle, inode, ACL_TYPE_DEFAULT,
>                                         default_acl, XATTR_CREATE);
>                  posix_acl_release(default_acl);
>          } else {
>                  inode->i_default_acl = NULL;
>          }
>          if (acl) {
>                  if (!error)
>                          error = __ext4_set_acl(handle, inode, ACL_TYPE_ACCESS,
>                                                 acl, XATTR_CREATE);
>                  posix_acl_release(acl);
>          } else {
>                  inode->i_acl = NULL;
>          }
> 	...
> 
> So for the readability and unity of the code, adjust this order.
> 
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Kari Argillander <kari.argillander@gmail.com>

> ---
>   fs/ntfs3/xattr.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
> index afd0ddad826f..64cefa869a61 100644
> --- a/fs/ntfs3/xattr.c
> +++ b/fs/ntfs3/xattr.c
> @@ -642,13 +642,13 @@ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
>   		inode->i_default_acl = NULL;
>   	}
>   
> -	if (!acl)
> -		inode->i_acl = NULL;
> -	else {
> +	if (acl) {
>   		if (!err)
>   			err = ntfs_set_acl_ex(mnt_userns, inode, acl,
>   					      ACL_TYPE_ACCESS);
>   		posix_acl_release(acl);
> +	} else {
> +		inode->i_acl = NULL;
>   	}
>   
>   	return err;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] ntfs3: Use the same order for acl pointer check in ntfs_init_acl
  2022-04-20 17:43 ` Kari Argillander
@ 2022-04-21  1:57   ` xuyang2018.jy
  2022-04-21  9:05     ` Kari Argillander
  0 siblings, 1 reply; 6+ messages in thread
From: xuyang2018.jy @ 2022-04-21  1:57 UTC (permalink / raw)
  To: Kari Argillander; +Cc: almaz.alexandrovich, ntfs3

on 2022/4/21 1:43, Kari Argillander wrote:
> I do not understand why this RFC and not a patch.
I don't sure whether this small nit is a problem and can be accepted by 
nfs3 group. So When generate a patch, I add RFC subject for it.
>
> On 20.4.2022 11.48, Yang Xu wrote:
>> Like ext4 and other use ${fs}_init_acl filesystem, they all used the
>> following
>> style
>>
>> error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
>> if (error)
>> return error;
>>
>> if (default_acl) {
>> error = __ext4_set_acl(handle, inode, ACL_TYPE_DEFAULT,
>> default_acl, XATTR_CREATE);
>> posix_acl_release(default_acl);
>> } else {
>> inode->i_default_acl = NULL;
>> }
>> if (acl) {
>> if (!error)
>> error = __ext4_set_acl(handle, inode, ACL_TYPE_ACCESS,
>> acl, XATTR_CREATE);
>> posix_acl_release(acl);
>> } else {
>> inode->i_acl = NULL;
>> }
>> ...
>>
>> So for the readability and unity of the code, adjust this order.
>>
>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
>
>> ---
>> fs/ntfs3/xattr.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
>> index afd0ddad826f..64cefa869a61 100644
>> --- a/fs/ntfs3/xattr.c
>> +++ b/fs/ntfs3/xattr.c
>> @@ -642,13 +642,13 @@ int ntfs_init_acl(struct user_namespace
>> *mnt_userns, struct inode *inode,
>> inode->i_default_acl = NULL;
>> }
>> - if (!acl)
>> - inode->i_acl = NULL;
>> - else {
>> + if (acl) {
>> if (!err)
>> err = ntfs_set_acl_ex(mnt_userns, inode, acl,
>> ACL_TYPE_ACCESS);
>> posix_acl_release(acl);
>> + } else {
>> + inode->i_acl = NULL;
>> }
>> return err;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] ntfs3: Use the same order for acl pointer check in ntfs_init_acl
  2022-04-21  1:57   ` xuyang2018.jy
@ 2022-04-21  9:05     ` Kari Argillander
  2022-04-21  9:17       ` xuyang2018.jy
  0 siblings, 1 reply; 6+ messages in thread
From: Kari Argillander @ 2022-04-21  9:05 UTC (permalink / raw)
  To: xuyang2018.jy; +Cc: almaz.alexandrovich, ntfs3

On 21.4.2022 4.57, xuyang2018.jy@fujitsu.com wrote:
> on 2022/4/21 1:43, Kari Argillander wrote:
>> I do not understand why this RFC and not a patch.
> I don't sure whether this small nit is a problem and can be accepted by
> nfs3 group. So When generate a patch, I add RFC subject for it.

RFC means request for comments. Usually this means that patch needs more
work but I would like to discuss this topic before I continue this work.
This was small nit and is no problem, but I just wanted to point that
out.

   Argillander

>> On 20.4.2022 11.48, Yang Xu wrote:
>>> Like ext4 and other use ${fs}_init_acl filesystem, they all used the
>>> following
>>> style
>>>
>>> error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
>>> if (error)
>>> return error;
>>>
>>> if (default_acl) {
>>> error = __ext4_set_acl(handle, inode, ACL_TYPE_DEFAULT,
>>> default_acl, XATTR_CREATE);
>>> posix_acl_release(default_acl);
>>> } else {
>>> inode->i_default_acl = NULL;
>>> }
>>> if (acl) {
>>> if (!error)
>>> error = __ext4_set_acl(handle, inode, ACL_TYPE_ACCESS,
>>> acl, XATTR_CREATE);
>>> posix_acl_release(acl);
>>> } else {
>>> inode->i_acl = NULL;
>>> }
>>> ...
>>>
>>> So for the readability and unity of the code, adjust this order.
>>>
>>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>> Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
>>
>>> ---
>>> fs/ntfs3/xattr.c | 6 +++---
>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
>>> index afd0ddad826f..64cefa869a61 100644
>>> --- a/fs/ntfs3/xattr.c
>>> +++ b/fs/ntfs3/xattr.c
>>> @@ -642,13 +642,13 @@ int ntfs_init_acl(struct user_namespace
>>> *mnt_userns, struct inode *inode,
>>> inode->i_default_acl = NULL;
>>> }
>>> - if (!acl)
>>> - inode->i_acl = NULL;
>>> - else {
>>> + if (acl) {
>>> if (!err)
>>> err = ntfs_set_acl_ex(mnt_userns, inode, acl,
>>> ACL_TYPE_ACCESS);
>>> posix_acl_release(acl);
>>> + } else {
>>> + inode->i_acl = NULL;
>>> }
>>> return err;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] ntfs3: Use the same order for acl pointer check in ntfs_init_acl
  2022-04-21  9:05     ` Kari Argillander
@ 2022-04-21  9:17       ` xuyang2018.jy
  0 siblings, 0 replies; 6+ messages in thread
From: xuyang2018.jy @ 2022-04-21  9:17 UTC (permalink / raw)
  To: Kari Argillander; +Cc: almaz.alexandrovich, ntfs3

on 2022/4/21 17:05, Kari Argillander wrote:
> On 21.4.2022 4.57, xuyang2018.jy@fujitsu.com wrote:
>> on 2022/4/21 1:43, Kari Argillander wrote:
>>> I do not understand why this RFC and not a patch.
>> I don't sure whether this small nit is a problem and can be accepted by
>> nfs3 group. So When generate a patch, I add RFC subject for it.
>
> RFC means request for comments. Usually this means that patch needs more
> work but I would like to discuss this topic before I continue this work.
> This was small nit and is no problem, but I just wanted to point that
> out.

Thanks, now I understand.

>
> Argillander
>
>>> On 20.4.2022 11.48, Yang Xu wrote:
>>>> Like ext4 and other use ${fs}_init_acl filesystem, they all used the
>>>> following
>>>> style
>>>>
>>>> error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
>>>> if (error)
>>>> return error;
>>>>
>>>> if (default_acl) {
>>>> error = __ext4_set_acl(handle, inode, ACL_TYPE_DEFAULT,
>>>> default_acl, XATTR_CREATE);
>>>> posix_acl_release(default_acl);
>>>> } else {
>>>> inode->i_default_acl = NULL;
>>>> }
>>>> if (acl) {
>>>> if (!error)
>>>> error = __ext4_set_acl(handle, inode, ACL_TYPE_ACCESS,
>>>> acl, XATTR_CREATE);
>>>> posix_acl_release(acl);
>>>> } else {
>>>> inode->i_acl = NULL;
>>>> }
>>>> ...
>>>>
>>>> So for the readability and unity of the code, adjust this order.
>>>>
>>>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>>> Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
>>>
>>>> ---
>>>> fs/ntfs3/xattr.c | 6 +++---
>>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
>>>> index afd0ddad826f..64cefa869a61 100644
>>>> --- a/fs/ntfs3/xattr.c
>>>> +++ b/fs/ntfs3/xattr.c
>>>> @@ -642,13 +642,13 @@ int ntfs_init_acl(struct user_namespace
>>>> *mnt_userns, struct inode *inode,
>>>> inode->i_default_acl = NULL;
>>>> }
>>>> - if (!acl)
>>>> - inode->i_acl = NULL;
>>>> - else {
>>>> + if (acl) {
>>>> if (!err)
>>>> err = ntfs_set_acl_ex(mnt_userns, inode, acl,
>>>> ACL_TYPE_ACCESS);
>>>> posix_acl_release(acl);
>>>> + } else {
>>>> + inode->i_acl = NULL;
>>>> }
>>>> return err;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] ntfs3: Use the same order for acl pointer check in ntfs_init_acl
  2022-04-20  8:48 [RFC] ntfs3: Use the same order for acl pointer check in ntfs_init_acl Yang Xu
  2022-04-20 17:43 ` Kari Argillander
@ 2022-06-09 16:22 ` Konstantin Komarov
  1 sibling, 0 replies; 6+ messages in thread
From: Konstantin Komarov @ 2022-06-09 16:22 UTC (permalink / raw)
  To: Yang Xu; +Cc: ntfs3



On 4/20/22 11:48, Yang Xu wrote:
> Like ext4 and other use ${fs}_init_acl filesystem, they all used the following
> style
> 
>         error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
>         if (error)
>                  return error;
> 
>          if (default_acl) {
>                  error = __ext4_set_acl(handle, inode, ACL_TYPE_DEFAULT,
>                                         default_acl, XATTR_CREATE);
>                  posix_acl_release(default_acl);
>          } else {
>                  inode->i_default_acl = NULL;
>          }
>          if (acl) {
>                  if (!error)
>                          error = __ext4_set_acl(handle, inode, ACL_TYPE_ACCESS,
>                                                 acl, XATTR_CREATE);
>                  posix_acl_release(acl);
>          } else {
>                  inode->i_acl = NULL;
>          }
> 	...
> 
> So for the readability and unity of the code, adjust this order.
> 
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>   fs/ntfs3/xattr.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
> index afd0ddad826f..64cefa869a61 100644
> --- a/fs/ntfs3/xattr.c
> +++ b/fs/ntfs3/xattr.c
> @@ -642,13 +642,13 @@ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
>   		inode->i_default_acl = NULL;
>   	}
>   
> -	if (!acl)
> -		inode->i_acl = NULL;
> -	else {
> +	if (acl) {
>   		if (!err)
>   			err = ntfs_set_acl_ex(mnt_userns, inode, acl,
>   					      ACL_TYPE_ACCESS);
>   		posix_acl_release(acl);
> +	} else {
> +		inode->i_acl = NULL;
>   	}
>   
>   	return err;

Applied, thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-09 16:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20  8:48 [RFC] ntfs3: Use the same order for acl pointer check in ntfs_init_acl Yang Xu
2022-04-20 17:43 ` Kari Argillander
2022-04-21  1:57   ` xuyang2018.jy
2022-04-21  9:05     ` Kari Argillander
2022-04-21  9:17       ` xuyang2018.jy
2022-06-09 16:22 ` Konstantin Komarov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.