Skip to content

Commit 91ef18b

Browse files
jankaratytso
authored andcommitted
ext4: mark inodes without acls in __ext4_iget()
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> Reviewed-by: Baokun Li <libaokun1@huawei.com> Message-ID: <20251125101340.24276-2-jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent cab8cbc commit 91ef18b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/ext4/inode.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5508,7 +5508,9 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
55085508
if (ret)
55095509
goto bad_inode;
55105510
brelse(iloc.bh);
5511-
5511+
/* Initialize the "no ACL's" state for the simple cases */
5512+
if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) && !ei->i_file_acl)
5513+
cache_no_acl(inode);
55125514
unlock_new_inode(inode);
55135515
return inode;
55145516

0 commit comments

Comments
 (0)