From 1b69d48e2850b54580d7a37271046143f4d26d13 Mon Sep 17 00:00:00 2001 From: mjg 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 213c79d0c25..4034a5d2834 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 3311512d56e..aa945491f75 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); \ -- 2.45.2