diff --git a/sys/nfsclient/nfs_node.c b/sys/nfsclient/nfs_node.c index 21769e227a19..ed19723abdd4 100644 --- a/sys/nfsclient/nfs_node.c +++ b/sys/nfsclient/nfs_node.c @@ -194,7 +194,10 @@ nfs_nget(struct mount *mntp, nfsfh_t *fhp, int fhsize, struct nfsnode **npp) bcmp((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize)) continue; vp = NFSTOV(np); - if (vget(vp, LK_EXCLUSIVE, td)) + /* + * np or vp may become invalid if vget() blocks, so loop + */ + if (vget(vp, LK_EXCLUSIVE|LK_SLEEPFAIL, td)) goto loop; *npp = np; return(0);