History log of /freebsd/sys/kern/vfs_lookup.c (Results 26 – 50 of 572)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/13.2.0
# 0c01203e 28-Mar-2023 Jason A. Harmening <jah@FreeBSD.org>

vfs_lookup(): re-check v_mountedhere on lock upgrade

The VV_CROSSLOCK handling logic may need to upgrade the covered
vnode lock depending upon the requirements of the filesystem into
which vfs_looku

vfs_lookup(): re-check v_mountedhere on lock upgrade

The VV_CROSSLOCK handling logic may need to upgrade the covered
vnode lock depending upon the requirements of the filesystem into
which vfs_lookup() is walking. This may involve transiently
dropping the lock, which can allow the target mount to be unmounted.

Tested by: pho
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D39272

show more ...


# 7b6fe242 08-Apr-2023 Konstantin Belousov <kib@FreeBSD.org>

DEBUG_VFS_LOCKS: use witness if available

The assert_vop_locked messages are ignored, and file/line information
is not too useful. Fixing this without changing both witness and VFS
asserts KPIs is n

DEBUG_VFS_LOCKS: use witness if available

The assert_vop_locked messages are ignored, and file/line information
is not too useful. Fixing this without changing both witness and VFS
asserts KPIs is not possible.

Reviewed by: markj (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39464

show more ...


# 829f0bcb 19-Dec-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: add the concept of vnode state transitions

To quote from a comment above vput_final:
<quote>
* XXX Some filesystems pass in an exclusively locked vnode and strongly depend
* on the lock being h

vfs: add the concept of vnode state transitions

To quote from a comment above vput_final:
<quote>
* XXX Some filesystems pass in an exclusively locked vnode and strongly depend
* on the lock being held all the way until VOP_INACTIVE. This in particular
* happens with UFS which adds half-constructed vnodes to the hash, where they
* can be found by other code.
</quote>

As is there is no mechanism which allows filesystems to denote that a
vnode is fully initialized, consequently problems like the above are
only found the hard way(tm).

Add rudimentary support for state transitions, which in particular allow
to assert the vnode is not legally unlocked until its fate is decided
(either construction finishes or vgone is called to abort it).

The new field lands in a 1-byte hole, thus it does not grow the struct.

Bump __FreeBSD_version to 1400077

Reviewed by: kib (previous version)
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D37759

show more ...


# 8f7859e8 14-Dec-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: retire the now unused SAVESTART flag

Bump __FreeBSD_version to 1400075

Tested by: pho


Revision tags: release/12.4.0
# 8f874e92 10-Nov-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: make relookup take an additional argument

instead of looking at SAVESTART

This is a step towards removing the flag.

Reviewed by: mckusick
Tested by: pho
Differential Revision: https://reviews

vfs: make relookup take an additional argument

instead of looking at SAVESTART

This is a step towards removing the flag.

Reviewed by: mckusick
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D34468

show more ...


# 269c564b 17-Nov-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: retire NDFREE

There are no consumers anymore. Interested parties can NDFREE_PNBUF
and vput or vrele relevant vnodes.

Tested by: pho


# 42442d7a 27-Oct-2022 Jason A. Harmening <jah@FreeBSD.org>

Generalize the VV_CROSSLOCK logic in vfs_lookup()

When VV_CROSSLOCK is present, the lock for the vnode at the current
stage of lookup must be held across the VFS_ROOT() call for the
filesystem mount

Generalize the VV_CROSSLOCK logic in vfs_lookup()

When VV_CROSSLOCK is present, the lock for the vnode at the current
stage of lookup must be held across the VFS_ROOT() call for the
filesystem mounted at the vnode. Since VV_CROSSLOCK implies that
the root vnode reuses the already-held lock, the possibility for
recursion should be made clear in the flags passed to VFS_ROOT().

For cases in which the lock is held exclusive, this means passing
LK_CANRECURSE. For cases in which the lock is held shared, it
means clearing LK_NODDLKTREAT to allow VFS_ROOT() to potentially
recurse on the shared lock even in the presence of an exclusive
waiter.

That the existing code works for unionfs is due to a coincidence
of the current unionfs implementation.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D37458

show more ...


# f7833196 20-Oct-2022 Jason A. Harmening <jah@FreeBSD.org>

vfs_lookup(): Minor performance optimizations

Refactor the symlink and mountpoint traversal logic to avoid
repeatedly checking the vnode type; a symlink cannot be a mountpoint
and vice versa. Avoid

vfs_lookup(): Minor performance optimizations

Refactor the symlink and mountpoint traversal logic to avoid
repeatedly checking the vnode type; a symlink cannot be a mountpoint
and vice versa. Avoid repeatedly checking cn_flags for NOCROSSMOUNT
and simplify the check which determines whether the vnode is a
mountpoint.

Suggested by: mjg
Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D35054

show more ...


# 706f15c5 05-Aug-2022 Jason A. Harmening <jah@FreeBSD.org>

Remove witness directives from crossmp locking VOPs

These are of limited use since the crossmp vnode locking ops have not
actually used a lock since commit
a2d35545429117e68fbcbc68e14ad55e84265d69.

Remove witness directives from crossmp locking VOPs

These are of limited use since the crossmp vnode locking ops have not
actually used a lock since commit
a2d35545429117e68fbcbc68e14ad55e84265d69. We in fact require that
these operations are always issued with LK_SHARED. Additionally,
these directives can produce a false positive in certain VV_CROSSLOCK
cases which require upgrading of the covered vnode lock from shared
to exclusive.

While here, replace the runtime check of LK_SHARED with a KASSERT and
expand the check to include LK_NOWAIT, which all callers pass.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D35054

show more ...


# 080ef8a4 05-Aug-2022 Jason A. Harmening <jah@FreeBSD.org>

Add VV_CROSSLOCK vnode flag to avoid cross-mount lookup LOR

When a lookup operation crosses into a new mountpoint, the mountpoint
must first be busied before the root vnode can be locked. When a
fil

Add VV_CROSSLOCK vnode flag to avoid cross-mount lookup LOR

When a lookup operation crosses into a new mountpoint, the mountpoint
must first be busied before the root vnode can be locked. When a
filesystem is unmounted, the vnode covered by the mountpoint must
first be locked, and then the busy count for the mountpoint drained.
Ordinarily, these two operations work fine if executed concurrently,
but with a stacked filesystem the root vnode may in fact use the
same lock as the covered vnode. By design, this will always be
the case for unionfs (with either the upper or lower root vnode
depending on mount options), and can also be the case for nullfs
if the target and mount point are the same (which admittedly is
very unlikely in practice).

In this case, we have LOR. The lookup path holds the mountpoint
busy while waiting on what is effectively the covered vnode lock,
while a concurrent unmount holds the covered vnode lock and waits
for the mountpoint's busy count to drain.

Attempt to resolve this LOR by allowing the stacked filesystem
to specify a new flag, VV_CROSSLOCK, on a covered vnode as necessary.
Upon observing this flag, the vfs_lookup() will leave the covered
vnode lock held while crossing into the mountpoint. Employ this flag
for unionfs with the caveat that it can't be used for '-o below' mounts
until other unionfs locking issues are resolved.

Reported by: pho
Tested by: pho
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D35054

show more ...


# b77bdfdb 17-Sep-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: fix non-INVARIANTS build after 5b5b7e2ca2fa9a2418dd51749f4ef6f881ae7179

Reported by: gj


# 5b5b7e2c 17-Sep-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: always retain path buffer after lookup

This removes some of the complexity needed to maintain HASBUF and
allows for removing injecting SAVENAME by filesystems.

Reviewed by: kib (previous versi

vfs: always retain path buffer after lookup

This removes some of the complexity needed to maintain HASBUF and
allows for removing injecting SAVENAME by filesystems.

Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D36542

show more ...


# 3df3d88c 17-Sep-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: move cn_nameptr assignment out of namei_getpath


# f7dc4a71 14-Sep-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: plug spurious error checks in namei

error is guaranteed 0 at that point


# b4137c9e 13-Sep-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: make NDVALIDATE private to vfs_lookup.c

it is not used elsewhere.


Revision tags: release/13.1.0
# 14312394 27-Apr-2022 John Baldwin <jhb@FreeBSD.org>

Add a __witness_used for variables only used under #ifdef WITNESS.

__diagused is now solely used for variables only used under INVARIANTS.

Reviewed by: mjg
Differential Revision: https://reviews.fr

Add a __witness_used for variables only used under #ifdef WITNESS.

__diagused is now solely used for variables only used under INVARIANTS.

Reviewed by: mjg
Differential Revision: https://reviews.freebsd.org/D35085

show more ...


# c9b04ee4 02-Apr-2022 Gordon Bergling <gbe@FreeBSD.org>

kern: Fix two typos in source code comments

- s/accomodate/accommodate/

MFC after: 3 days


# 0c805718 24-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: fix memory leak on lookup with fds with ioctl caps

Reviewed by: markj
PR: 262515
Noted by: firk@cantconnect.ru
Differential Revision: https://reviews.freebsd.org/D34667


# a4032e2a 26-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: assorted tidy ups to lookup

No functional changes.


# 0f600883 25-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: set cn_namelen when handling degenerate lookups

Turns out execve looks at it to store binary name, but in order to
trigger the problem one has to be trying to exec '/'. As is the value
would be

vfs: set cn_namelen when handling degenerate lookups

Turns out execve looks at it to store binary name, but in order to
trigger the problem one has to be trying to exec '/'. As is the value
would be left uninitialized (or rather set to -1 on debug kernels).

Fixes: 56244d35741a62e7 ("vfs: hoist degenerate path lookups out of the
loop")

show more ...


# 4ef6e56a 24-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: hoist trailing slash handling out of the loop


# 3b6792d2 24-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: factor symlink traversal out of namei

The intent down the road is to eliminate the loop to begin with,
pushing traversal down to vfs_lookup, all while not allocating the
extra buffer.


# d9ea7e2b 13-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: factor FAILIFEXISTS handling out of vfs_lookup


# 56244d35 11-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: hoist degenerate path lookups out of the loop


# bb92cd7b 24-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

vfs: NDFREE(&nd, NDF_ONLY_PNBUF) -> NDFREE_PNBUF(&nd)


12345678910>>...23