Author: dfr
Date: Fri Oct 24 16:04:10 2008
New Revision: 184227
URL: http://svn.freebsd.org/changeset/base/184227

Log:
  Don't rely on the value of *statep without first taking the vnode interlock.
  
  Reviewed by:  Mike Tancsa
  MFC after:    2 weeks

Modified:
  head/sys/kern/kern_lockf.c

Modified: head/sys/kern/kern_lockf.c
==============================================================================
--- head/sys/kern/kern_lockf.c  Fri Oct 24 14:40:13 2008        (r184226)
+++ head/sys/kern/kern_lockf.c  Fri Oct 24 16:04:10 2008        (r184227)
@@ -467,12 +467,15 @@ lf_advlockasync(struct vop_advlockasync_
        /*
         * 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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to