Lock Giant around vn_open_cred().

Remove innocent unnecessary call to NDFREE().

Reported by:	marcel
Reviewed and tested by:	pjd
MFC after:	3 days
This commit is contained in:
kib 2009-09-08 09:17:34 +00:00
parent 7faac77b19
commit 69ea57cacb

View File

@ -69,7 +69,7 @@ kobj_open_file_vnode(const char *file)
struct thread *td = curthread;
struct filedesc *fd;
struct nameidata nd;
int error, flags;
int error, flags, vfslocked;
fd = td->td_proc->p_fd;
FILEDESC_XLOCK(fd);
@ -86,11 +86,13 @@ kobj_open_file_vnode(const char *file)
flags = FREAD | O_NOFOLLOW;
NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td);
error = vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL);
NDFREE(&nd, NDF_ONLY_PNBUF);
if (error != 0)
return (NULL);
vfslocked = NDHASGIANT(&nd);
NDFREE(&nd, NDF_ONLY_PNBUF);
/* We just unlock so we hold a reference. */
VOP_UNLOCK(nd.ni_vp, 0);
VFS_UNLOCK_GIANT(vfslocked);
return (nd.ni_vp);
}