vfs: disallow NOCACHE with LOOKUP

This means there is no expectation lookup will purge the terminal entry,
which simplifies lockless lookup.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mateusz Guzik 2020-08-10 10:33:40 +00:00
parent fc9fcee01a
commit 7f70080150
2 changed files with 4 additions and 1 deletions

View File

@ -484,6 +484,9 @@ namei(struct nameidata *ndp)
("namei: nameiop contaminated with flags"));
KASSERT((cnp->cn_flags & OPMASK) == 0,
("namei: flags contaminated with nameiops"));
if (cnp->cn_flags & NOCACHE)
KASSERT(cnp->cn_nameiop != LOOKUP,
("%s: NOCACHE passed with LOOKUP", __func__));
MPASS(ndp->ni_startdir == NULL || ndp->ni_startdir->v_type == VDIR ||
ndp->ni_startdir->v_type == VBAD);

View File

@ -408,7 +408,7 @@ sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS)
buf[req->newlen] = '\0';
ndflags = LOCKLEAF | NOFOLLOW | AUDITVNODE1 | NOCACHE | SAVENAME;
ndflags = LOCKLEAF | NOFOLLOW | AUDITVNODE1 | SAVENAME;
NDINIT(&nd, LOOKUP, ndflags, UIO_SYSSPACE, buf, curthread);
if ((error = namei(&nd)) != 0)
goto out;