Don't rely on the value of *statep without first taking the vnode interlock.

Reviewed by:	Mike Tancsa
MFC after:	2 weeks
This commit is contained in:
Doug Rabson 2008-10-24 16:04:10 +00:00
parent 5584732fa2
commit 842832aeae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=184227

View File

@ -467,12 +467,15 @@ lf_advlockasync(struct vop_advlockasync_args *ap, struct lockf **statep,
/*
* Avoid the common case of unlocking when inode has no locks.
*/
if ((*statep) == NULL || LIST_EMPTY(&(*statep)->ls_active)) {
VI_LOCK(vp);
if ((*statep) == NULL) {
if (ap->a_op != F_SETLK) {
fl->l_type = F_UNLCK;
VI_UNLOCK(vp);
return (0);
}
}
VI_UNLOCK(vp);
/*
* Map our arguments to an existing lock owner or create one