From f1fcaffd8edf5c362a565e890355c6d3b8988fe0 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Mon, 13 Jan 2020 14:33:51 +0000 Subject: [PATCH] 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 --- sys/ufs/ffs/ffs_vnops.c | 2 +- sys/ufs/ufs/inode.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 213c79d0c250..4034a5d2834a 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -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, diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index 3311512d56ed..aa945491f752 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -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); \