Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Aug 2011 08:22:16 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r224704 - stable/8/sys/kern
Message-ID:  <201108080822.p788MG0s037591@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Aug  8 08:22:15 2011
New Revision: 224704
URL: http://svn.freebsd.org/changeset/base/224704

Log:
  MFC r224581:
  Fix the LK_NOSHARE lockmgr flag interaction with LK_UPGRADE and
  LK_DOWNGRADE lock ops. Namely, the ops should be NOP since LK_NOSHARE
  locks are always exclusive.

Modified:
  stable/8/sys/kern/kern_lock.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/kern/kern_lock.c
==============================================================================
--- stable/8/sys/kern/kern_lock.c	Mon Aug  8 05:25:51 2011	(r224703)
+++ stable/8/sys/kern/kern_lock.c	Mon Aug  8 08:22:15 2011	(r224704)
@@ -451,8 +451,18 @@ __lockmgr_args(struct lock *lk, u_int fl
 		return (0);
 	}
 
-	if (op == LK_SHARED && (lk->lock_object.lo_flags & LK_NOSHARE))
-		op = LK_EXCLUSIVE;
+	if (lk->lock_object.lo_flags & LK_NOSHARE) {
+		switch (op) {
+		case LK_SHARED:
+			op = LK_EXCLUSIVE;
+			break;
+		case LK_UPGRADE:
+		case LK_DOWNGRADE:
+			_lockmgr_assert(lk, KA_XLOCKED | KA_NOTRECURSED,
+			    file, line);
+			return (0);
+		}
+	}
 
 	wakeup_swapper = 0;
 	switch (op) {



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