ext4: Mark inodes without acls in __ext4_iget()
Jan Kara
reviewerPATCH 1/1 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 :).
--- fs/ext4/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/inode.c +3 -1
@@ -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;
Signature · 1 line
2.51.0
Quoted 7 lines · Jan Kara
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 callingcheck_acl()to cache ACL state.
Quoted 7 lines
The problem was originally analyzed by Linus and fix tested by Matheusz, I'm just putting it into mergeable form :).
Looks good! Feel free to add:
Quoted 19 lines
--- fs/ext4/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/ext4/inode.c +3
-1@@ -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;
Quoted 7 lines · Jan Kara
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 callingcheck_acl()to cache ACL state.
Quoted 7 lines
The problem was originally analyzed by Linus and fix tested by Matheusz, I'm just putting it into mergeable form :).
This makes sense to me.
Quoted 19 lines
--- fs/ext4/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/ext4/inode.c +3
-1@@ -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;
Quoted 8 lines · Jan Kara
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 callingcheck_acl()to cache ACL state.[...]
Applied, thanks!
[1/1] ext4: Mark inodes without acls in __ext4_iget()
commit: 91ef18b567dae84c0cea9b996d933c856e366f52
Best regards,
Signature · 1 line
Theodore Ts'o <[email protected]>