Work around the "nfscl: bad open cnt on server" assertion

that can happen when rerooting into NFSv4 rootfs with kernel
built with INVARIANTS.

I've talked to rmacklem@ (back in 2017), and while the root cause
is still unknown, the case guarded by assertion (nfscl_doclose()
being called from VOP_INACTIVE) is believed to be safe, and the
whole thing seems to run just fine.

Obtained from:	CheriBSD
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
This commit is contained in:
Edward Tomasz Napierala 2019-02-19 12:45:37 +00:00
parent e998861bbb
commit c9172fb4f1

View file

@ -3188,8 +3188,11 @@ lookformore:
!NFSBCMP(op->nfso_fh, nfhp->nfh_fh,
nfhp->nfh_len)) {
/* Found an open, close it. */
#ifdef DIAGNOSTIC
KASSERT((op->nfso_opencnt == 0),
("nfscl: bad open cnt on server"));
("nfscl: bad open cnt on server (%d)",
op->nfso_opencnt));
#endif
NFSUNLOCKCLSTATE();
nfsrpc_doclose(VFSTONFS(vnode_mount(vp)), op,
p);