2018-08-14 14:16:30

by Chengguang Xu

[permalink] [raw]
Subject: [PATCH 1/5] ext2: cache NULL when both default_acl and acl are NULL

default_acl and acl of newly created inode will be initiated
as ACL_NOT_CACHED in vfs function inode_init_always() and later
will be updated by calling xxx_init_acl() in specific filesystems.
Howerver, when default_acl and acl are NULL then they keep the value
of ACL_NOT_CACHED, this patch tries to cache NULL for acl/default_acl
in this case.

Signed-off-by: Chengguang Xu <[email protected]>
---
fs/ext2/acl.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 224c04abb2e5..74411e8ea507 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -262,5 +262,8 @@ ext2_init_acl(struct inode *inode, struct inode *dir)
error = __ext2_set_acl(inode, acl, ACL_TYPE_ACCESS);
posix_acl_release(acl);
}
+ if (!default_acl && !acl)
+ cache_no_acl(inode);
+
return error;
}
--
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


2018-08-14 14:16:31

by Chengguang Xu

[permalink] [raw]
Subject: [PATCH 2/5] ext4: cache NULL when both default_acl and acl are NULL

default_acl and acl of newly created inode will be initiated
as ACL_NOT_CACHED in vfs function inode_init_always() and later
will be updated by calling xxx_init_acl() in specific filesystems.
Howerver, when default_acl and acl are NULL then they keep the value
of ACL_NOT_CACHED, this patch tries to cache NULL for acl/default_acl
in this case.

Signed-off-by: Chengguang Xu <[email protected]>
---
fs/ext4/acl.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index fb50f9aa6ead..69a01d28356d 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -291,5 +291,8 @@ ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
acl, XATTR_CREATE);
posix_acl_release(acl);
}
+ if (!default_acl && !acl)
+ cache_no_acl(inode);
+
return error;
}
--
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

2018-08-14 14:16:32

by Chengguang Xu

[permalink] [raw]
Subject: [PATCH 3/5] f2fs: cache NULL when both default_acl and acl are NULL

default_acl and acl of newly created inode will be initiated
as ACL_NOT_CACHED in vfs function inode_init_always() and later
will be updated by calling xxx_init_acl() in specific filesystems.
Howerver, when default_acl and acl are NULL then they keep the value
of ACL_NOT_CACHED, this patch tries to cache NULL for acl/default_acl
in this case.

Signed-off-by: Chengguang Xu <[email protected]>
---
fs/f2fs/acl.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index 111824199a88..97ed555316be 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -401,6 +401,8 @@ int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage,
ipage);
posix_acl_release(acl);
}
+ if (!default_acl && !acl)
+ cache_no_acl(inode);

return error;
}
--
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

2018-08-14 14:16:33

by Chengguang Xu

[permalink] [raw]
Subject: [PATCH 4/5] jfs: cache NULL when both default_acl and acl are NULL

default_acl and acl of newly created inode will be initiated
as ACL_NOT_CACHED in vfs function inode_init_always() and later
will be updated by calling xxx_init_acl() in specific filesystems.
Howerver, when default_acl and acl are NULL then they keep the value
of ACL_NOT_CACHED, this patch tries to cache NULL for acl/default_acl
in this case.

Signed-off-by: Chengguang Xu <[email protected]>
---
fs/jfs/acl.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 2e71b6e7e646..15b9a9b74d72 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -154,6 +154,9 @@ int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir)
posix_acl_release(acl);
}

+ if (!default_acl && !acl)
+ cache_no_acl(inode);
+
JFS_IP(inode)->mode2 = (JFS_IP(inode)->mode2 & 0xffff0000) |
inode->i_mode;

--
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

2018-08-14 14:16:34

by Chengguang Xu

[permalink] [raw]
Subject: [PATCH 5/5] orangefs: cache NULL when both default_acl and acl are NULL

default_acl and acl of newly created inode will be initiated
as ACL_NOT_CACHED in vfs function inode_init_always() and later
will be updated by calling xxx_init_acl() in specific filesystems.
Howerver, when default_acl and acl are NULL then they keep the value
of ACL_NOT_CACHED, this patch tries to cache NULL for acl/default_acl
in this case.

Signed-off-by: Chengguang Xu <[email protected]>
---
fs/orangefs/acl.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/orangefs/acl.c b/fs/orangefs/acl.c
index 10587413b20e..e3b043a263bc 100644
--- a/fs/orangefs/acl.c
+++ b/fs/orangefs/acl.c
@@ -175,6 +175,9 @@ int orangefs_init_acl(struct inode *inode, struct inode *dir)
posix_acl_release(acl);
}

+ if (!default_acl && !acl)
+ cache_no_acl(inode);
+
/* If mode of the inode was changed, then do a forcible ->setattr */
if (mode != inode->i_mode) {
memset(&iattr, 0, sizeof iattr);
--
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

2018-08-29 13:18:15

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH 1/5] ext2: cache NULL when both default_acl and acl are NULL

On Tue 14-08-18 22:16:30, Chengguang Xu wrote:
> default_acl and acl of newly created inode will be initiated
> as ACL_NOT_CACHED in vfs function inode_init_always() and later
> will be updated by calling xxx_init_acl() in specific filesystems.
> Howerver, when default_acl and acl are NULL then they keep the value
> of ACL_NOT_CACHED, this patch tries to cache NULL for acl/default_acl
> in this case.
>
> Signed-off-by: Chengguang Xu <[email protected]>
> ---
> fs/ext2/acl.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
> index 224c04abb2e5..74411e8ea507 100644
> --- a/fs/ext2/acl.c
> +++ b/fs/ext2/acl.c
> @@ -262,5 +262,8 @@ ext2_init_acl(struct inode *inode, struct inode *dir)
> error = __ext2_set_acl(inode, acl, ACL_TYPE_ACCESS);
> posix_acl_release(acl);
> }
> + if (!default_acl && !acl)
> + cache_no_acl(inode);
> +

Thanks for the patch. I'd somewhat prefer something equivalent to:

if (!acl)
inode->i_acl = NULL;
if (!default_acl)
inode->i_default_acl = NULL;

given the code in ext2_init_acl(). It would be most natural like:

if (default_acl) {
do foo
} else {
inode->i_default_acl = NULL;
}

And similarly for 'acl'.

Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR