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 <[email protected]>
---
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
on 2022/4/19 22:03, Christian Brauner wrote:
> On Tue, Apr 19, 2022 at 07:47:12PM +0800, 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<[email protected]>
>> ---
>
> Again, this patch is irrelevant to the main drive of this patch series
> and it's sensitive enough as it is. Just drop it from this series and
> upstream it separately to the relevant filesystem imho.
OK, will do.
On Tue, Apr 19, 2022 at 07:47:12PM +0800, 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 <[email protected]>
> ---
Again, this patch is irrelevant to the main drive of this patch series
and it's sensitive enough as it is. Just drop it from this series and
upstream it separately to the relevant filesystem imho.