Repository navigation
vfs: fetch stat in PseudoFs access check only when required - #184
Merged
Merged
Conversation
Motivation: PseudoFs#checkAccess fetches the inode's stat from the inner file system before evaluating the access request, as the stat is needed for the unix permission check. However, that check is the last resort and is skipped when the export has the all_root option or the file system's AclCheckable grants or denies the access. In these cases the stat is fetched for nothing, which costs an extra getattr on the inner file system for every LOOKUP (stat of the parent) and every ACL read. Modification: Pass a null stat from the convenience overload and fetch it right before the unix permission check, if the caller hasn't provided one. The access operation, which already has the stat at hand, passes it as before. Result: No extra getattr on the inner file system when all_root or the AclCheckable decides the access. Behaviour is unchanged otherwise. Fixes: dCache#183 Target: master Signed-off-by: Yves Langisch <yla@iterate.ch>
Member
|
@ylangisc, thanks for your contribution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
PseudoFs#checkAccessfetches the inode's stat from the inner file system up front, as the stat is needed for the unix permission check. That check is the last resort though: it's skipped when the export has theall_rootoption or when the file system'sAclCheckablegrants or denies the access. In these cases the stat is fetched for nothing, costing an extragetattron the inner file system for every LOOKUP (stat of the parent directory) and every ACL read.For file systems where
getattris not a cheap local call this adds up quickly when listing large directories. dc8d38d already removed the fetch forACE4_READ_ATTRIBUTES; this change covers the remaining cases without changing semantics.Modification
Pass a
nullstat from the convenience overload and fetch it right before the unix permission check, if the caller hasn't provided one.access, which already has the stat at hand, passes it as before.Tests added: no
getattron the inner file system when theAclCheckableallows the access or the export hasall_root;getattris still performed when the unix permission check is reached.Result
No extra
getattron the inner file system whenall_rootor theAclCheckabledecides the access. Behaviour is unchanged otherwise, including the error returned when the access is denied.Fixes: #183
Target: master