nfsrv_lookup(): Defer the postopattr lookup on dirp until the

child node is unlocked.

Ok: YAMAMOTO Takashi <yamt@netbsd.org>
This commit is contained in:
hannken 2011-11-21 09:07:59 +00:00
parent 35d9543121
commit 0114172335
1 changed files with 18 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_serv.c,v 1.161 2011/10/30 12:00:27 hannken Exp $ */
/* $NetBSD: nfs_serv.c,v 1.162 2011/11/21 09:07:59 hannken Exp $ */
/*
* Copyright (c) 1989, 1993
@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.161 2011/10/30 12:00:27 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.162 2011/11/21 09:07:59 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -453,15 +453,6 @@ nfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct lwp *l
}
}
if (dirp) {
if (v3) {
vn_lock(dirp, LK_SHARED | LK_RETRY);
dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred);
VOP_UNLOCK(dirp);
}
vrele(dirp);
}
if (error) {
if (nd.ni_pathbuf != NULL) {
pathbuf_destroy(nd.ni_pathbuf);
@ -469,6 +460,14 @@ nfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct lwp *l
if (ipb != NULL) {
pathbuf_destroy(ipb);
}
if (dirp) {
if (v3) {
vn_lock(dirp, LK_SHARED | LK_RETRY);
dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred);
vput(dirp);
} else
vrele(dirp);
}
nfsm_reply(NFSX_POSTOPATTR(v3));
nfsm_srvpostop_attr(dirattr_ret, &dirattr);
return (0);
@ -484,6 +483,14 @@ nfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct lwp *l
if (!error)
error = VOP_GETATTR(vp, &va, cred);
vput(vp);
if (dirp) {
if (v3) {
vn_lock(dirp, LK_SHARED | LK_RETRY);
dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred);
vput(dirp);
} else
vrele(dirp);
}
nfsm_reply(NFSX_SRVFH(&nsfh, v3) + NFSX_POSTOPORFATTR(v3) +
NFSX_POSTOPATTR(v3));
if (error) {