]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vfs: prevent avoidable evictions on mkdir of existing directories
authorMateusz Guzik <mjg@FreeBSD.org>
Thu, 22 Oct 2020 19:28:12 +0000 (19:28 +0000)
committerMateusz Guzik <mjg@FreeBSD.org>
Thu, 22 Oct 2020 19:28:12 +0000 (19:28 +0000)
commitc7520caa4f57b5022db419d69e44832f67926fe5
tree248a65a8c626a5c68568a79649075a6ffaaacec1
parentad5e10ec0cecfd33c75be5690cff7bc47514467e
vfs: prevent avoidable evictions on mkdir of existing directories

mkdir -p /foo/bar/baz will mkdir each path component and ignore EEXIST.

The NOCACHE lookup will make the namecache unnecessarily evict the existing entry,
and then fallback to the fs lookup routine eventually leading namei to return an
error as the directory is already there.

For invocations like mkdir -p /usr/obj/usr/src/sys/GENERIC/modules this triggers
fallbacks to the slowpath for concurrently executing lookups.

Tested by: pho
Discussed with: kib
sys/kern/vfs_cache.c
sys/kern/vfs_subr.c
sys/kern/vfs_syscalls.c
sys/kern/vnode_if.src
sys/sys/namei.h
sys/sys/vnode.h