Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Oct 2008 16:04:10 +0000 (UTC)
From:      Doug Rabson <dfr@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r184227 - head/sys/kern
Message-ID:  <200810241604.m9OG4AfH093704@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810241604.m9OG4AfH093704>