Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vfs: fix description comment of vfs_lookup() #737

Closed
wants to merge 2 commits into from

Conversation

ihoro
Copy link
Contributor

@ihoro ihoro commented May 8, 2023

No description provided.

Signed-off-by: Igor Ostapenko <pm@igoro.pro>
@ihoro ihoro force-pushed the fix-vfs-lookup-description-comment branch from d7c1145 to d541fce Compare May 8, 2023 19:06
Copy link
Contributor

@mhorne mhorne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the submission.

This change looks good, and I am happy to merge it, but one question: did you audit any other details of the comment? The entire comment is quite old (1994/1995), and I believe the high-level description still applies but maybe some other details are stale.

If not it is okay, I will just make a note of it in the commit message before pushing.

@ihoro
Copy link
Contributor Author

ihoro commented Jun 20, 2023

Actually, this is a good question. I simply corrected obvious thing which caught my eyes. From a bit deeper overview I could propose the subsequent commit of changes.

* descended until done, or a symbolic link is encountered. The variable
* ni_more is clear if the path is completed; it is set to one if a
* descended until done, or a symbolic link is encountered. The cn_flags
* has ISLASTCN or'ed if the path is completed or ISSYMLINK or'ed if a
* symbolic link needing interpretation is encountered.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks that some time ago it was passed as ni_more variable as a flag, today it works with cn_flags bits instead.

* the target is returned locked, otherwise it is returned unlocked.
* When creating or renaming and LOCKPARENT is specified, the target may not
* be ".". When deleting and LOCKPARENT is specified, the target may be ".".
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both statements seem to be outdated, probably it makes sense to simply remove them. As I see, at least two cases (RENAME+dot and DELETE+dot) work another way today - it simply returns with EINVAL regardless locking option.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep this as a followup... I'm going to merge this, but feel free to followup on this detail

*
* Overall outline of lookup:
*
* handle degenerate case where name is null string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously it was mentioned to be done upon each dirloop iteration, but today it's done once before the loop.

* dirloop:
* identify next component of name at ndp->ni_cnd.cn_nameptr
* handle degenerate case where name is null string
* handle .. special cases related to capabilities, chroot, jail
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to mention a bit more cases related to the well-known subsystems.

* if .. and crossing mount points and on mounted filesys, find parent
* call VOP_LOOKUP routine for next component name
* directory vnode returned in ni_dvp, unlocked unless LOCKPARENT set
* component vnode returned in ni_vp (if it exists), locked.
* if result vnode is mounted on and crossing mount points,
* find mounted on vnode
* if more components of name, do next level at dirloop
* if VOP_LOOKUP returned ERELOOKUP, repeat the same level at dirloop
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, it's useful to mention a case when dirloop iteration can be repeated for the same component name again. This mechanism was added for specific autofs case: 213ed83

Signed-off-by: Igor Ostapenko <pm@igoro.pro>
@ihoro ihoro force-pushed the fix-vfs-lookup-description-comment branch from 6143101 to f10cecf Compare June 20, 2023 23:35
@bsdimp
Copy link
Member

bsdimp commented Jun 27, 2023

7b5a1c3 landed.

@bsdimp bsdimp closed this Jun 27, 2023
freebsd-git pushed a commit that referenced this pull request Jun 27, 2023
Signed-off-by: Igor Ostapenko <pm@igoro.pro>
Reviewed by: imp, mhorne
Pull Request: #737
freebsd-git pushed a commit that referenced this pull request Jun 27, 2023
Signed-off-by: Igor Ostapenko <pm@igoro.pro>
Reviewed by: imp, mhorne
Pull Request: #737
bsdjhb pushed a commit to bsdjhb/cheribsd that referenced this pull request Aug 29, 2023
Signed-off-by: Igor Ostapenko <pm@igoro.pro>
Reviewed by: imp, mhorne
Pull Request: freebsd/freebsd-src#737
bsdjhb pushed a commit to bsdjhb/cheribsd that referenced this pull request Aug 29, 2023
Signed-off-by: Igor Ostapenko <pm@igoro.pro>
Reviewed by: imp, mhorne
Pull Request: freebsd/freebsd-src#737
@emaste emaste added the merged label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants