Temporary workaround to prevent leak of Giant from nfsd when calling

lookup().

Reviewed by:	tegge
Tested by:	"Arno J. Klaassen" <arno at heho snv jussieu fr>, "Rong-en Fan" <grafan at gmail com>, Dmitriy Kirhlarov <dimma at higis ru>, Dmitry Pryanishnikov <dmitry at atlantis dp ua>
MFC after:	1 week
Approved by:	kan, pjd (mentors)
This commit is contained in:
Konstantin Belousov 2006-06-05 14:48:02 +00:00
parent c62502d1f6
commit 273147358f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159268
2 changed files with 20 additions and 0 deletions

View File

@ -570,6 +570,10 @@ nfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
error = lookup(&ind);
ind.ni_dvp = NULL;
if (ind.ni_cnd.cn_flags & GIANTHELD) {
mtx_unlock(&Giant);
ind.ni_cnd.cn_flags &= ~GIANTHELD;
}
if (error == 0) {
/*
@ -1918,6 +1922,10 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
error = lookup(&nd);
nd.ni_dvp = NULL;
if (nd.ni_cnd.cn_flags & GIANTHELD) {
mtx_unlock(&Giant);
nd.ni_cnd.cn_flags &= ~GIANTHELD;
}
if (error)
goto ereply;
@ -2145,6 +2153,10 @@ nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
error = lookup(&nd);
nd.ni_dvp = NULL;
if (nd.ni_cnd.cn_flags & GIANTHELD) {
mtx_unlock(&Giant);
nd.ni_cnd.cn_flags &= ~GIANTHELD;
}
if (error)
goto out;
@ -2886,6 +2898,10 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
error = lookup(&nd);
nd.ni_dvp = NULL;
if (nd.ni_cnd.cn_flags & GIANTHELD) {
mtx_unlock(&Giant);
nd.ni_cnd.cn_flags &= ~GIANTHELD;
}
if (error == 0) {
bzero((caddr_t)fhp, sizeof(nfh));

View File

@ -876,6 +876,10 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
}
if (!lockleaf)
cnp->cn_flags &= ~LOCKLEAF;
if (cnp->cn_flags & GIANTHELD) {
mtx_unlock(&Giant);
cnp->cn_flags &= ~GIANTHELD;
}
/*
* nfs_namei() guarentees that fields will not contain garbage