Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Aug 2014 09:02:02 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r270795 - in head/sys: kern sys
Message-ID:  <201408290902.s7T922Dq027555@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Aug 29 09:02:01 2014
New Revision: 270795
URL: http://svnweb.freebsd.org/changeset/base/270795

Log:
  Add function and wrapper to switch lockmgr and vnode lock back to
  auto-promotion of shared to exclusive.
  
  Tested by:	hrs, pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/kern/kern_lock.c
  head/sys/sys/lockmgr.h
  head/sys/sys/vnode.h

Modified: head/sys/kern/kern_lock.c
==============================================================================
--- head/sys/kern/kern_lock.c	Fri Aug 29 08:55:58 2014	(r270794)
+++ head/sys/kern/kern_lock.c	Fri Aug 29 09:02:01 2014	(r270795)
@@ -418,6 +418,14 @@ lockallowshare(struct lock *lk)
 }
 
 void
+lockdisableshare(struct lock *lk)
+{
+
+	lockmgr_assert(lk, KA_XLOCKED);
+	lk->lock_object.lo_flags |= LK_NOSHARE;
+}
+
+void
 lockallowrecurse(struct lock *lk)
 {
 

Modified: head/sys/sys/lockmgr.h
==============================================================================
--- head/sys/sys/lockmgr.h	Fri Aug 29 08:55:58 2014	(r270794)
+++ head/sys/sys/lockmgr.h	Fri Aug 29 09:02:01 2014	(r270795)
@@ -77,6 +77,7 @@ void	 lockallowrecurse(struct lock *lk);
 void	 lockallowshare(struct lock *lk);
 void	 lockdestroy(struct lock *lk);
 void	 lockdisablerecurse(struct lock *lk);
+void	 lockdisableshare(struct lock *lk);
 void	 lockinit(struct lock *lk, int prio, const char *wmesg, int timo,
 	    int flags);
 #ifdef DDB

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h	Fri Aug 29 08:55:58 2014	(r270794)
+++ head/sys/sys/vnode.h	Fri Aug 29 09:02:01 2014	(r270795)
@@ -428,6 +428,7 @@ extern	struct vattr va_null;		/* predefi
 
 #define	VN_LOCK_AREC(vp)	lockallowrecurse((vp)->v_vnlock)
 #define	VN_LOCK_ASHARE(vp)	lockallowshare((vp)->v_vnlock)
+#define	VN_LOCK_DSHARE(vp)	lockdisableshare((vp)->v_vnlock)
 
 #endif /* _KERNEL */
 



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