Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/vfs_getcwd.c
RevisionDateAuthorComments
 1.63  07-Dec-2024  riastradh vfs(9): Sprinkle SET_ERROR dtrace probes.

PR kern/58378: Kernel error code origination lacks dtrace probes
 1.62  07-Dec-2024  riastradh vfs(9): Sprinkle KNF.

No functional change intended.
 1.61  29-Jun-2021  dholland branches: 1.61.16;
Now remove cn_consume from struct componentname.

This change requires a kernel bump.

Note though that I'm not going to version the VOP_LOOKUP args
structure (or any other args structure) as code that doesn't touch
cn_consume doesn't need attention and code that does will fail on it
without further intervention.
 1.60  16-May-2020  christos branches: 1.60.6;
Add ACL support for FFS. From FreeBSD.
 1.59  21-Apr-2020  ad Revert the changes made in February to make cwdinfo use mostly lockless,
which relied on taking extra vnode refs.

Having benchmarked various experimental changes over the past few months it
seems that it's better to avoid vnode refs as much as possible. cwdi_lock
as a RW lock already did that to some extent for getcwd() and will permit
the same for namei() too.
 1.58  13-Apr-2020  ad Replace most uses of vp->v_usecount with a call to vrefcnt(vp), a function
that hides the details and does atomic_load_relaxed(). Signature matches
FreeBSD.
 1.57  04-Apr-2020  ad branches: 1.57.2;
Merge the remaining changes from the ad-namecache branch, affecting namei()
and getcwd():

- push vnode locking back as far as possible.
- do most lookups directly in the namecache, avoiding vnode locks & refs.
- don't block new refs to vnodes across VOP_INACTIVE().
- get shared locks for VOP_LOOKUP() if the file system supports it.
- correct lock types for VOP_ACCESS() / VOP_GETATTR() in a few places.

Possible future enhancements:

- make the lookups lockless.
- support dotdot lookups by being lockless and inferring absence of chroot.
- maybe make it work for layered file systems.
- avoid vnode references at the root & cwd.
 1.56  22-Mar-2020  ad Merge vfs_cache.c from the ad-namecache branch. With this the namecache
index becomes per-directory (initially, a red-black tree). The remaining
changes on the branch to namei()/getcwd() will be merged in the future.
 1.55  23-Feb-2020  ad Merge from ad-namecache:

- Have a stab at clustering the members of vnode_t and vnode_impl_t in a
more cache-conscious way. With that done, go back to adjusting v_usecount
with atomics and keep vi_lock directly in vnode_impl_t (saves KVA).

- Allow VOP_LOCK(LK_NONE) for the benefit of VFS_VGET() and VFS_ROOT().
Make sure LK_UPGRADE always comes with LK_NOWAIT.

- Make cwdinfo use mostly lockless.
 1.54  08-Jan-2020  ad - options NAMECACHE_ENTER_REVERSE is no more.

- Partially sort the list of per-vnode namecache entries by using a TAILQ.
Put the real name to the head, and put dot and dotdot to the tail so that
cache_lookup_reverse() doesn't have to consider them.
 1.53  14-Sep-2019  christos branches: 1.53.2;
- add missing error check
- use '\0' for char const
 1.52  28-Jul-2017  riastradh branches: 1.52.4;
Don't walk off the end of the dirent buffer.

From Ilja Van Sprundel.
 1.51  01-Jun-2017  chs branches: 1.51.2;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.50  07-Feb-2014  hannken branches: 1.50.4; 1.50.6; 1.50.8; 1.50.16;
Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
 1.49  09-Jun-2013  dholland branches: 1.49.2;
Stick UFS_ in front of these symbols:
DIRBLKSIZ
DIRECTSIZ
DIRSIZ
OLDDIRFMT
NEWDIRFMT

Part of PR 47909.

(two stragglers in this commit; oops)
 1.48  05-Nov-2012  dholland Disentangle the namecache from the internals of namei.

- Move the namecache's hash computation to inside the namecache code,
instead of being spread out all over the place. Remove cn_hash from
struct componentname and delete all uses of it.

- It is no longer necessary (if it ever was) for cache_lookup and
cache_lookup_raw to clear MAKEENTRY from cnp->cn_flags for the cases
that cache_enter already checks for.

- Rearrange the interface of cache_lookup (and cache_lookup_raw) to
make it somewhat simpler, to exclude certain nonexistent error
conditions, and (most importantly) to make it not require write access
to cnp->cn_flags.

This change requires a kernel bump.
 1.47  30-Nov-2010  dholland branches: 1.47.8; 1.47.14; 1.47.18; 1.47.20; 1.47.22;
Abolish struct componentname's cn_pnbuf. Use the path buffer in the
pathbuf object passed to namei as work space instead. (For now a pnbuf
pointer appears in struct nameidata, to support certain unclean things
that haven't been fixed yet, but it will be going away in the future.)

This removes the need for the SAVENAME and HASBUF namei flags.
 1.46  21-Jul-2010  hannken Using cache_revlookup() leads to vnode races as it returns an unreferenced
vnode that may disappear before the caller has a chance to reference it.

Reference the vnode while the name cache is locked.

No objections on tech-kern.
 1.45  24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.44  08-Jan-2010  pooka branches: 1.44.2; 1.44.4;
The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase). Plenty of mix'n match upper/lowercase has creeped
into the tree since then. Nuke the macros and convert all callsites
to lowercase.

no functional change
 1.43  17-Jan-2009  yamt malloc -> kmem_alloc.
 1.42  28-Apr-2008  martin branches: 1.42.2; 1.42.8;
Remove clause 3 and 4 from TNF licenses
 1.41  20-Dec-2007  dsl branches: 1.41.6; 1.41.8; 1.41.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.40  08-Dec-2007  pooka branches: 1.40.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.39  03-Dec-2007  christos branches: 1.39.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core
 1.38  26-Nov-2007  pooka Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.37  10-Oct-2007  ad branches: 1.37.4;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.36  08-Oct-2007  ad Merge file descriptor locking, cwdi locking and cross-call changes
from the vmlocking branch.
 1.35  09-Feb-2007  ad branches: 1.35.6; 1.35.18; 1.35.20; 1.35.22;
Merge newlock2 to head.
 1.34  09-Dec-2006  chs a smorgasbord of improvements to vnode locking and path lookup:
- LOCKPARENT is no longer relevant for lookup(), relookup() or VOP_LOOKUP().
these now always return the parent vnode locked. namei() works as before.
lookup() and various other paths no longer acquire vnode locks in the
wrong order via vrele(). fixes PR 32535.
as a nice side effect, path lookup is also up to 25% faster.
- the above allows us to get rid of PDIRUNLOCK.
- also get rid of WANTPARENT (just use LOCKPARENT and unlock it).
- remove an assumption in layer_node_find() that all file systems implement
a recursive VOP_LOCK() (unionfs doesn't).
- require that all file systems supply vfs_vptofh and vfs_fhtovp routines.
fill in eopnotsupp() for file systems that don't support being exported
and remove the checks for NULL. (layerfs calls these without checking.)
- in union_lookup1(), don't change refcounts in the ISDOTDOT case, just
adjust which vnode is locked. fixes PR 33374.
- apply fixes for ufs_rename() from ufs_vnops.c rev. 1.61 to ext2fs_rename().
 1.33  25-Oct-2006  christos branches: 1.33.2;
Defer the vnode test for directory until after the cache lookup. This makes
getcwd work with plain files too, if we allow plain files in the vnode->name
cache.
 1.32  23-Jul-2006  ad branches: 1.32.4; 1.32.6;
Use the LWP cached credentials where sane.
 1.31  14-May-2006  elad integrate kauth.
 1.30  01-Mar-2006  yamt branches: 1.30.2; 1.30.4; 1.30.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.29  11-Dec-2005  christos branches: 1.29.2; 1.29.4; 1.29.6;
merge ktrace-lwp.
 1.28  19-Aug-2005  christos 64 bit inode changes.
 1.27  05-Jun-2005  thorpej branches: 1.27.2;
Use ANSI function decls.
 1.26  17-Sep-2004  skrll There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.25  23-Mar-2004  junyoung Nuke __P().
 1.24  17-Feb-2004  enami Some whitespace fix.
 1.23  17-Feb-2004  enami The vnode capability id is gone.
 1.22  17-Feb-2004  enami Rewind the `bp' advanced backward by cache_revlookup() if getcwd_getcache()
finally returns cache miss.

# Slightly modified from posted version so that it is cleanly patchable
# at least on 1.6 branch.
 1.21  30-Jul-2003  yamt eliminate v_id.
 1.20  29-Jun-2003  fvdl branches: 1.20.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.19  29-Jun-2003  thorpej Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.18  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.17  16-Apr-2003  christos move declaration of getcwd_common and constant to the header file.
 1.16  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.15  12-Nov-2001  lukem branches: 1.15.10;
add RCSIDs
 1.14  15-Dec-2000  fvdl branches: 1.14.2; 1.14.4; 1.14.8;
Jump out of the scandir loop if VOP_READDIR returns an error, avoiding
running around in circles.
 1.13  30-Mar-2000  augustss branches: 1.13.4;
Get rid of register declarations.
 1.12  30-Dec-1999  eeh Make getcwd_common() available to COMPAT_NETBSD32 code as well.
 1.11  15-Dec-1999  jdolecek g/c redundant vn_isunder() prototype (it.s in <sys/vnode.h>)
minor KNF changes
 1.10  11-Jul-1999  sommerfeld branches: 1.10.2; 1.10.8;
Fix kern/7944: getcwd permission checking was overly restrictive.
(Don't require start directory to have read permission).
 1.9  04-Jul-1999  sommerfeld Housecleaning time:

Fix and document naming convention for vnode variables (always use
lvp/lvpp and uvp/uvpp instead of a hash of cvp, vpp, dvpp, pvp, pvpp).

Delete old stale #if 0'ed code at the end.

Change error path code in getcwd_getcache() slightly (merge common
cleanup code; shouldn't affect behavior any).
 1.8  21-Jun-1999  sommerfeld Fix PR7373 for real: Rearrange locking to avoid need for LOCKPARENT in lookup
 1.7  19-Jun-1999  sommerfeld Fix PR7761: clip overly large length rather than failing
 1.6  30-Apr-1999  thorpej Break cdir/rdir/cmask info out of struct filedesc, and put it in a new
substructure, `cwdinfo'. Implement optional sharing of this substructure.

This is required for clone(2).
 1.5  26-Apr-1999  is Fix adosfs's locking panic
 1.4  05-Apr-1999  sommerfe Fix compile warning (not seen with egcs, but...)
 1.3  25-Mar-1999  sommerfe branches: 1.3.2;
Disallow tracing of processes unless tracer's root directory is at or
above tracee's root directory.
 1.2  25-Mar-1999  nathanw Garbage collect a non-useful variable in getcwd_scandir().
 1.1  22-Mar-1999  sommerfe Change namei cache to record vnode->(parent,name) entries (for directories).
Add kernel implementation of getcwd() which uses this cache, falling
back to reading the filesystem on a cache miss.
Along for the ride: add new VOP_FSYNC flag FSYNC_RECLAIM indicating
that a reclaim is being done, so only a "shallow" fsync is needed.
 1.3.2.3  11-Jul-1999  sommerfeld This commit approved in advance by rel-eng

Pullup of -current version of getcwd implementation, with
clone(2)-specific changes backed out (which required a manual merge).

Fixes:
7944: getcwd permission checking overly strict.
7761: getcwd with large buffer fails spuriously.
7373: recursive lock deadlock for adosfs (correct, non-stopgap fix;
changed to not use LOCKPARENT).
Also, significant code cleanup to error paths which may fix the problems
reported in 7881.
 1.3.2.2  28-Apr-1999  perry branches: 1.3.2.2.2; 1.3.2.2.4;
pullup 1.4->1.5 (is): kludge around adosfs panic
 1.3.2.1  05-Apr-1999  sommerfe Pull up 1.4: fix non-egcs uninit variable warning
 1.3.2.2.4.1  30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.3.2.2.2.3  02-Aug-1999  thorpej Update from trunk.
 1.3.2.2.2.2  01-Jul-1999  thorpej Sync w/ -current.
 1.3.2.2.2.1  21-Jun-1999  thorpej Sync w/ -current.
 1.10.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.10.2.2  05-Jan-2001  bouyer Sync with HEAD
 1.10.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.13.4.1  24-Dec-2000  jhawk Pull up revision 1.14 (requested by fvdl):
Avoid an infinite loop if VOP_READDIR returned an error.
 1.14.8.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.14.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.4  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.14.2.3  29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.14.2.2  14-Nov-2001  nathanw Catch up to -current.
 1.14.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.15.10.2  15-Mar-2004  jmc Pullup rev hand patch (requested by enami in ticket #1617)

Fix LP64 bugs triggered by overflow.
 1.15.10.1  15-Mar-2004  jmc Pullup rev 1.22 (requested by enami in ticket #1616)

Rewind the 'bp' advanced backward by cache_revlookup() if getcwd_getcache()
finally returns cache miss.
 1.20.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.20.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.20.2.3  24-Aug-2004  skrll Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.20.2.2  03-Aug-2004  skrll Sync with HEAD
 1.20.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.27.2.6  21-Jan-2008  yamt sync with head
 1.27.2.5  07-Dec-2007  yamt sync with head
 1.27.2.4  27-Oct-2007  yamt sync with head.
 1.27.2.3  26-Feb-2007  yamt sync with head.
 1.27.2.2  30-Dec-2006  yamt sync with head.
 1.27.2.1  21-Jun-2006  yamt sync with head.
 1.29.6.2  01-Jun-2006  kardel Sync with head.
 1.29.6.1  22-Apr-2006  simonb Sync with head.
 1.29.4.1  09-Sep-2006  rpaulo sync with head
 1.29.2.1  31-Dec-2005  yamt uio_segflg/uio_lwp -> uio_vmspace.
 1.30.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.30.4.2  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.30.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.30.2.2  11-Aug-2006  yamt sync with head
 1.30.2.1  24-May-2006  yamt sync with head.
 1.32.6.1  10-Dec-2006  yamt sync with head.
 1.32.4.3  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.32.4.2  12-Jan-2007  ad Sync with head.
 1.32.4.1  18-Nov-2006  ad Sync with head.
 1.33.2.1  17-Feb-2007  tron Apply patch (requested by chs in ticket #422):
- Fix various deadlock problems with nullfs and unionfs.
- Speed up path lookups by upto 25%.
 1.35.22.1  14-Oct-2007  yamt sync with head.
 1.35.20.2  09-Jan-2008  matt sync with HEAD
 1.35.20.1  06-Nov-2007  matt sync with HEAD
 1.35.18.4  09-Dec-2007  jmcneill Sync with HEAD.
 1.35.18.3  03-Dec-2007  joerg Sync with HEAD.
 1.35.18.2  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.35.18.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.35.6.2  08-Oct-2007  ad sys_getcwd: lock the cwdinfo.
 1.35.6.1  17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.37.4.2  27-Dec-2007  mjf Sync with HEAD.
 1.37.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.39.2.1  26-Dec-2007  ad Sync with head.
 1.40.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.41.10.4  11-Aug-2010  yamt sync with head.
 1.41.10.3  11-Mar-2010  yamt sync with head
 1.41.10.2  04-May-2009  yamt sync with head.
 1.41.10.1  16-May-2008  yamt sync with head.
 1.41.8.1  18-May-2008  yamt sync with head.
 1.41.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.41.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.42.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.42.2.2  14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.42.2.1  10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.44.4.2  05-Mar-2011  rmind sync with head
 1.44.4.1  03-Jul-2010  rmind sync with head
 1.44.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.47.22.1  19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1482):
sys/kern/vfs_getcwd.c: revision 1.52
Don't walk off the end of the dirent buffer.
From Ilja Van Sprundel.
 1.47.20.1  19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1482):
sys/kern/vfs_getcwd.c: revision 1.52
Don't walk off the end of the dirent buffer.
From Ilja Van Sprundel.
 1.47.18.4  03-Dec-2017  jdolecek update from HEAD
 1.47.18.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.47.18.2  23-Jun-2013  tls resync from head
 1.47.18.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.47.14.1  19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1482):
sys/kern/vfs_getcwd.c: revision 1.52
Don't walk off the end of the dirent buffer.
From Ilja Van Sprundel.
 1.47.8.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.47.8.1  16-Jan-2013  yamt sync with (a bit old) head
 1.49.2.1  18-May-2014  rmind sync with head
 1.50.16.1  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1478):
sys/kern/vfs_getcwd.c: revision 1.52
Don't walk off the end of the dirent buffer.
From Ilja Van Sprundel.
 1.50.8.1  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1478):
sys/kern/vfs_getcwd.c: revision 1.52
Don't walk off the end of the dirent buffer.
From Ilja Van Sprundel.
 1.50.6.1  28-Aug-2017  skrll Sync with HEAD
 1.50.4.1  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1478):
sys/kern/vfs_getcwd.c: revision 1.52
Don't walk off the end of the dirent buffer.
From Ilja Van Sprundel.
 1.51.2.1  09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #192):
sys/kern/vfs_getcwd.c: revision 1.52
Don't walk off the end of the dirent buffer.
From Ilja Van Sprundel.
 1.52.4.3  21-Apr-2020  martin Sync with HEAD
 1.52.4.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.52.4.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.53.2.5  29-Feb-2020  ad Sync with head.
 1.53.2.4  25-Jan-2020  ad Make cwdinfo use mostly lockless, and largely hide the details in vfs_cwd.c.
 1.53.2.3  19-Jan-2020  ad - Add a LOCKSHARED flag to namei (matching FreeBSD) indicating that we want
the leaf locked with LK_SHARED.

- Add an IMNT_SHRLOOKUP flag to struct mount indicating that the file
system can do VOP_LOOKUP() with an shared lock. If it encounters
something tricky, VOP_LOOKUP() is free to return ENOLCK and namei() will
retry the lookup with an exclusive lock. If the file system has this flag
set, namei() will try with shared locks for all of the "read only"
lookups, i.e. nameiop=LOOKUP or !ISLASTCN.

- vfs_getcwd: only take vnode locks when really needed, take shared locks if
possible, and where the namecache has identify info for the directories,
do it all in the namecache.

- vfs_lookup: when crossing mountpoints take only a shared lock on the
covered vnode; don't need anything else.
 1.53.2.2  17-Jan-2020  ad - Get shared locks on the directories, except for VOP_GETATTR() which
unfortunately still needs LK_EXCLUSIVE due to itimes handling in UFS.

- vnode locks are not needed to traverse the namecache.
 1.53.2.1  17-Jan-2020  ad Sync with head.
 1.57.2.2  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.57.2.1  20-Apr-2020  bouyer Sync with HEAD
 1.60.6.1  01-Aug-2021  thorpej Sync with HEAD.
 1.61.16.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed