Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2019 16:21:24 +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: r353892 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs sys vm
Message-ID:  <201910221621.x9MGLOjW062099@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Oct 22 16:21:24 2019
New Revision: 353892
URL: https://svnweb.freebsd.org/changeset/base/353892

Log:
  Assert that vnode_pager_setsize() is called with the vnode exclusively locked
  
  except for filesystems that set the MNTK_VMSETSIZE_BUG,  Set the flag for ZFS.
  
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks
  Differential revision:	https://reviews.freebsd.org/D21883

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  head/sys/sys/mount.h
  head/sys/vm/vnode_pager.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	Tue Oct 22 16:17:38 2019	(r353891)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	Tue Oct 22 16:21:24 2019	(r353892)
@@ -1394,6 +1394,7 @@ zfs_domount(vfs_t *vfsp, char *osname)
 	vfsp->mnt_kern_flag |= MNTK_EXTENDED_SHARED;
 	vfsp->mnt_kern_flag |= MNTK_NO_IOPF;	/* vn_io_fault can be used */
 	vfsp->mnt_kern_flag |= MNTK_NOMSYNC;
+	vfsp->mnt_kern_flag |= MNTK_VMSETSIZE_BUG;
 
 	/*
 	 * The fsid is 64 bits, composed of an 8-bit fs type, which

Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h	Tue Oct 22 16:17:38 2019	(r353891)
+++ head/sys/sys/mount.h	Tue Oct 22 16:21:24 2019	(r353892)
@@ -411,6 +411,7 @@ void          __mnt_vnode_markerfree_active(struct vno
 #define	MNTK_UNMAPPED_BUFS	0x00002000
 #define	MNTK_USES_BCACHE	0x00004000 /* FS uses the buffer cache. */
 #define	MNTK_TEXT_REFS		0x00008000 /* Keep use ref for text */
+#define	MNTK_VMSETSIZE_BUG	0x00010000
 #define MNTK_NOASYNC	0x00800000	/* disable async */
 #define MNTK_UNMOUNT	0x01000000	/* unmount in progress */
 #define	MNTK_MWAIT	0x02000000	/* waiting for unmount to finish */

Modified: head/sys/vm/vnode_pager.c
==============================================================================
--- head/sys/vm/vnode_pager.c	Tue Oct 22 16:17:38 2019	(r353891)
+++ head/sys/vm/vnode_pager.c	Tue Oct 22 16:21:24 2019	(r353892)
@@ -444,7 +444,16 @@ vnode_pager_setsize(struct vnode *vp, vm_ooffset_t nsi
 
 	if ((object = vp->v_object) == NULL)
 		return;
-/* 	ASSERT_VOP_ELOCKED(vp, "vnode_pager_setsize and not locked vnode"); */
+#ifdef DEBUG_VFS_LOCKS
+	{
+		struct mount *mp;
+
+		mp = vp->v_mount;
+		if (mp != NULL && (mp->mnt_kern_flag & MNTK_VMSETSIZE_BUG) == 0)
+			assert_vop_elocked(vp,
+			    "vnode_pager_setsize and not locked vnode");
+	}
+#endif
 	VM_OBJECT_WLOCK(object);
 	if (object->type == OBJT_DEAD) {
 		VM_OBJECT_WUNLOCK(object);



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