Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Dec 2013 06:12:22 +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-10@freebsd.org
Subject:   svn commit: r259296 - in stable/10/sys: kern vm
Message-ID:  <201312130612.rBD6CMM7083417@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Dec 13 06:12:21 2013
New Revision: 259296
URL: http://svnweb.freebsd.org/changeset/base/259296

Log:
  MFC r257899:
  If filesystem declares that it supports shared locking for writes, use
  shared vnode lock for VOP_PUTPAGES() as well.

Modified:
  stable/10/sys/kern/vnode_if.src
  stable/10/sys/vm/vm_pageout.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/vnode_if.src
==============================================================================
--- stable/10/sys/kern/vnode_if.src	Fri Dec 13 06:10:49 2013	(r259295)
+++ stable/10/sys/kern/vnode_if.src	Fri Dec 13 06:12:21 2013	(r259296)
@@ -477,7 +477,7 @@ vop_getpages {
 };
 
 
-%% putpages	vp	E E E
+%% putpages	vp	L L L
 
 vop_putpages {
 	IN struct vnode *vp;

Modified: stable/10/sys/vm/vm_pageout.c
==============================================================================
--- stable/10/sys/vm/vm_pageout.c	Fri Dec 13 06:10:49 2013	(r259295)
+++ stable/10/sys/vm/vm_pageout.c	Fri Dec 13 06:12:21 2013	(r259296)
@@ -570,6 +570,7 @@ vm_pageout_launder(struct vm_pagequeue *
 	vm_object_t object;
 	vm_paddr_t pa;
 	vm_page_t m, m_tmp, next;
+	int lockmode;
 
 	vm_pagequeue_lock(pq);
 	TAILQ_FOREACH_SAFE(m, &pq->pq_pl, plinks.q, next) {
@@ -605,7 +606,9 @@ vm_pageout_launder(struct vm_pagequeue *
 				vm_object_reference_locked(object);
 				VM_OBJECT_WUNLOCK(object);
 				(void)vn_start_write(vp, &mp, V_WAIT);
-				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+				lockmode = MNT_SHARED_WRITES(vp->v_mount) ?
+				    LK_SHARED : LK_EXCLUSIVE;
+				vn_lock(vp, lockmode | LK_RETRY);
 				VM_OBJECT_WLOCK(object);
 				vm_object_page_clean(object, 0, 0, OBJPC_SYNC);
 				VM_OBJECT_WUNLOCK(object);
@@ -902,6 +905,7 @@ vm_pageout_scan(struct vm_domain *vmd, i
 	int act_delta;
 	int vnodes_skipped = 0;
 	int maxlaunder;
+	int lockmode;
 	boolean_t queues_locked;
 
 	/*
@@ -1193,7 +1197,9 @@ vm_pageout_scan(struct vm_domain *vmd, i
 				    ("vp %p with NULL v_mount", vp));
 				vm_object_reference_locked(object);
 				VM_OBJECT_WUNLOCK(object);
-				if (vget(vp, LK_EXCLUSIVE | LK_TIMELOCK,
+				lockmode = MNT_SHARED_WRITES(vp->v_mount) ?
+				    LK_SHARED : LK_EXCLUSIVE;
+				if (vget(vp, lockmode | LK_TIMELOCK,
 				    curthread)) {
 					VM_OBJECT_WLOCK(object);
 					++pageout_lock_miss;



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