Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jan 2020 14:33:51 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356683 - in head/sys/ufs: ffs ufs
Message-ID:  <202001131433.00DEXpx7070028@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Mon Jan 13 14:33:51 2020
New Revision: 356683
URL: https://svnweb.freebsd.org/changeset/base/356683

Log:
  ufs: relax an overzealous assert added in r356671
  
  Part of i_flag can persist across a drop to hold count of 0, at which
  point the vnode is taken off the lazy list. Then whoever locks and unlocks
  the vnode can trip on the assert.
  
  This trips over kyua running a test untarring character devices to ufs.
  
  Reported by:	lwhsu

Modified:
  head/sys/ufs/ffs/ffs_vnops.c
  head/sys/ufs/ufs/inode.h

Modified: head/sys/ufs/ffs/ffs_vnops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vnops.c	Mon Jan 13 14:30:19 2020	(r356682)
+++ head/sys/ufs/ffs/ffs_vnops.c	Mon Jan 13 14:33:51 2020	(r356683)
@@ -485,7 +485,7 @@ ffs_unlock_debug(struct vop_unlock_args *ap)
 	struct vnode *vp = ap->a_vp;
 	struct inode *ip = VTOI(vp);
 
-	if (ip->i_flag & UFS_INODE_FLAG_LAZY_MASK) {
+	if (ip->i_flag & UFS_INODE_FLAG_LAZY_MASK_ASSERTABLE) {
 		if ((vp->v_mflag & VMP_LAZYLIST) == 0) {
 			VI_LOCK(vp);
 			VNASSERT((vp->v_mflag & VMP_LAZYLIST), vp,

Modified: head/sys/ufs/ufs/inode.h
==============================================================================
--- head/sys/ufs/ufs/inode.h	Mon Jan 13 14:30:19 2020	(r356682)
+++ head/sys/ufs/ufs/inode.h	Mon Jan 13 14:33:51 2020	(r356683)
@@ -140,6 +140,12 @@ struct inode {
 
 #define UFS_INODE_FLAG_LAZY_MASK	\
 	(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE | IN_LAZYMOD | IN_LAZYACCESS)
+/*
+ * Some flags can persist a vnode transitioning to 0 hold count and being tkaen
+ * off the list.
+ */
+#define UFS_INODE_FLAG_LAZY_MASK_ASSERTABLE \
+	(UFS_INODE_FLAG_LAZY_MASK & ~(IN_LAZYMOD | IN_LAZYACCESS))
 
 #define UFS_INODE_SET_FLAG(ip, flags) do {			\
 	struct inode *_ip = (ip);				\



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