diff options
-rw-r--r-- | sys/kern/vfs_subr.c | 3 | ||||
-rw-r--r-- | sys/sys/vnode.h | 2 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index b421902..b38bc16 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2378,6 +2378,9 @@ loop: if (vp->v_flag & VXLOCK) /* XXX: what if MNT_WAIT? */ continue; + if (vp->v_flag & VNOSYNC) /* unlinked, skip it */ + continue; + if (flags != MNT_WAIT) { if (VOP_GETVOBJECT(vp, &obj) != 0 || (obj->flags & OBJ_MIGHTBEDIRTY) == 0) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index f00bc03..9ee79d1 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -163,7 +163,7 @@ struct vnode { #define VXLOCK 0x00100 /* vnode is locked to change underlying type */ #define VXWANT 0x00200 /* process is waiting for vnode */ #define VBWAIT 0x00400 /* waiting for output to complete */ -/* open for business 0x00800 */ +#define VNOSYNC 0x01000 /* unlinked, stop syncing */ /* open for business 0x01000 */ #define VOBJBUF 0x02000 /* Allocate buffers in VM object */ #define VCOPYONWRITE 0x04000 /* vnode is doing copy-on-write */ diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index c0826cf..e52bf93 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -758,6 +758,8 @@ ufs_remove(ap) goto out; } error = ufs_dirremove(dvp, ip, ap->a_cnp->cn_flags, 0); + if (ip->i_nlink <= 0) + vp->v_flag |= VNOSYNC; VN_KNOTE(vp, NOTE_DELETE); VN_KNOTE(dvp, NOTE_WRITE); out: |