* [PATCH] ext4: Mark inodes without acls in __ext4_iget()
@ 2025-11-25 10:13 Jan Kara
2025-11-26 3:41 ` Baokun Li
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jan Kara @ 2025-11-25 10:13 UTC (permalink / raw)
To: Ted Tso; +Cc: linux-ext4, Mateusz Guzik, Jan Kara, Linus Torvalds
Mark inodes without acls with cache_no_acl() in __ext4_iget() so that
path lookup can run in RCU mode from the start. This is interesting in
particular for the case where the file owner does the lookup because in
that case end up constantly hitting the slow path otherwise. We drop out
from the fast path (because ACL state is unknown) but never end up calling
check_acl() to cache ACL state.
The problem was originally analyzed by Linus and fix tested by Matheusz,
I'm just putting it into mergeable form :).
Link: https://lore.kernel.org/all/CAHk-=whSzc75TLLPWskV0xuaHR4tpWBr=LduqhcCFr4kCmme_w@mail.gmail.com
Reported-by: Mateusz Guzik <mjguzik@gmail.com>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/inode.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e99306a8f47c..2b68d0651652 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5521,7 +5521,9 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
if (ret)
goto bad_inode;
brelse(iloc.bh);
-
+ /* Initialize the "no ACL's" state for the simple cases */
+ if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) && !ei->i_file_acl)
+ cache_no_acl(inode);
unlock_new_inode(inode);
return inode;
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Mark inodes without acls in __ext4_iget()
2025-11-25 10:13 [PATCH] ext4: Mark inodes without acls in __ext4_iget() Jan Kara
@ 2025-11-26 3:41 ` Baokun Li
2025-11-26 7:19 ` Zhang Yi
2025-12-01 16:23 ` Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Baokun Li @ 2025-11-26 3:41 UTC (permalink / raw)
To: Jan Kara; +Cc: Ted Tso, linux-ext4, Mateusz Guzik, Linus Torvalds
On 2025-11-25 18:13, Jan Kara wrote:
> Mark inodes without acls with cache_no_acl() in __ext4_iget() so that
> path lookup can run in RCU mode from the start. This is interesting in
> particular for the case where the file owner does the lookup because in
> that case end up constantly hitting the slow path otherwise. We drop out
> from the fast path (because ACL state is unknown) but never end up calling
> check_acl() to cache ACL state.
>
> The problem was originally analyzed by Linus and fix tested by Matheusz,
> I'm just putting it into mergeable form :).
>
> Link: https://lore.kernel.org/all/CAHk-=whSzc75TLLPWskV0xuaHR4tpWBr=LduqhcCFr4kCmme_w@mail.gmail.com
> Reported-by: Mateusz Guzik <mjguzik@gmail.com>
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Jan Kara <jack@suse.cz>
Looks good! Feel free to add:
Reviewed-by: Baokun Li <libaokun1@huawei.com>
> ---
> fs/ext4/inode.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index e99306a8f47c..2b68d0651652 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -5521,7 +5521,9 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
> if (ret)
> goto bad_inode;
> brelse(iloc.bh);
> -
> + /* Initialize the "no ACL's" state for the simple cases */
> + if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) && !ei->i_file_acl)
> + cache_no_acl(inode);
> unlock_new_inode(inode);
> return inode;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Mark inodes without acls in __ext4_iget()
2025-11-25 10:13 [PATCH] ext4: Mark inodes without acls in __ext4_iget() Jan Kara
2025-11-26 3:41 ` Baokun Li
@ 2025-11-26 7:19 ` Zhang Yi
2025-12-01 16:23 ` Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Zhang Yi @ 2025-11-26 7:19 UTC (permalink / raw)
To: Jan Kara, Ted Tso; +Cc: linux-ext4, Mateusz Guzik, Linus Torvalds
On 11/25/2025 6:13 PM, Jan Kara wrote:
> Mark inodes without acls with cache_no_acl() in __ext4_iget() so that
> path lookup can run in RCU mode from the start. This is interesting in
> particular for the case where the file owner does the lookup because in
> that case end up constantly hitting the slow path otherwise. We drop out
> from the fast path (because ACL state is unknown) but never end up calling
> check_acl() to cache ACL state.
>
> The problem was originally analyzed by Linus and fix tested by Matheusz,
> I'm just putting it into mergeable form :).
>
> Link: https://lore.kernel.org/all/CAHk-=whSzc75TLLPWskV0xuaHR4tpWBr=LduqhcCFr4kCmme_w@mail.gmail.com
> Reported-by: Mateusz Guzik <mjguzik@gmail.com>
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Jan Kara <jack@suse.cz>
This makes sense to me.
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
> ---
> fs/ext4/inode.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index e99306a8f47c..2b68d0651652 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -5521,7 +5521,9 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
> if (ret)
> goto bad_inode;
> brelse(iloc.bh);
> -
> + /* Initialize the "no ACL's" state for the simple cases */
> + if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) && !ei->i_file_acl)
> + cache_no_acl(inode);
> unlock_new_inode(inode);
> return inode;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: Mark inodes without acls in __ext4_iget()
2025-11-25 10:13 [PATCH] ext4: Mark inodes without acls in __ext4_iget() Jan Kara
2025-11-26 3:41 ` Baokun Li
2025-11-26 7:19 ` Zhang Yi
@ 2025-12-01 16:23 ` Theodore Ts'o
2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2025-12-01 16:23 UTC (permalink / raw)
To: Jan Kara; +Cc: Theodore Ts'o, linux-ext4, Mateusz Guzik, Linus Torvalds
On Tue, 25 Nov 2025 11:13:41 +0100, Jan Kara wrote:
> Mark inodes without acls with cache_no_acl() in __ext4_iget() so that
> path lookup can run in RCU mode from the start. This is interesting in
> particular for the case where the file owner does the lookup because in
> that case end up constantly hitting the slow path otherwise. We drop out
> from the fast path (because ACL state is unknown) but never end up calling
> check_acl() to cache ACL state.
>
> [...]
Applied, thanks!
[1/1] ext4: Mark inodes without acls in __ext4_iget()
commit: 91ef18b567dae84c0cea9b996d933c856e366f52
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-01 16:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25 10:13 [PATCH] ext4: Mark inodes without acls in __ext4_iget() Jan Kara
2025-11-26 3:41 ` Baokun Li
2025-11-26 7:19 ` Zhang Yi
2025-12-01 16:23 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox