From 05c6b40c0d429243e6e525bbfe4fd2e75fc84a69 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 6 Feb 2006 10:15:27 +0000 Subject: [PATCH] - Don't check v_mount for NULL to determine if a vnode has been recycled. Use the more appropriate VI_DOOMED flag instead. Sponsored by: Isilon Systems, Inc. MFC After: 1 week --- sys/kern/vfs_cache.c | 2 +- sys/kern/vfs_extattr.c | 6 ++++-- sys/kern/vfs_lookup.c | 4 ++-- sys/kern/vfs_syscalls.c | 6 ++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 4dfbe93669e1..dbb07f98d7d4 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -824,7 +824,7 @@ vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir, } while (vp != rdir && vp != rootvnode) { if (vp->v_vflag & VV_ROOT) { - if (vp->v_mount == NULL) { /* forced unmount */ + if (vp->v_iflag & VI_DOOMED) { /* forced unmount */ error = EBADF; break; } diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 035ba9223816..dcd36960f8fd 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -318,14 +318,16 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf) struct file *fp; struct mount *mp; struct statfs *sp, sb; + struct vnode *vp; int error; error = getvnode(td->td_proc->p_fd, fd, &fp); if (error) return (error); - mp = fp->f_vnode->v_mount; + vp = fp->f_vnode; + mp = vp->v_mount; fdrop(fp, td); - if (mp == NULL) + if (vp->v_iflag & VI_DOOMED) return (EBADF); mtx_lock(&Giant); #ifdef MAC diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index de8be729b695..4d47123c986f 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -514,7 +514,7 @@ dirloop: if ((dp->v_vflag & VV_ROOT) == 0 || (cnp->cn_flags & NOCROSSMOUNT)) break; - if (dp->v_mount == NULL) { /* forced unmount */ + if (dp->v_iflag & VI_DOOMED) { /* forced unmount */ error = EBADF; goto bad; } @@ -659,7 +659,7 @@ unionlookup: ((cnp->cn_flags & FOLLOW) || trailing_slash || *ndp->ni_next == '/')) { cnp->cn_flags |= ISSYMLINK; - if (dp->v_mount == NULL) { + if (dp->v_iflag & VI_DOOMED) { /* We can't know whether the directory was mounted with * NOSYMFOLLOW, so we can't follow safely. */ error = EBADF; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 035ba9223816..dcd36960f8fd 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -318,14 +318,16 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf) struct file *fp; struct mount *mp; struct statfs *sp, sb; + struct vnode *vp; int error; error = getvnode(td->td_proc->p_fd, fd, &fp); if (error) return (error); - mp = fp->f_vnode->v_mount; + vp = fp->f_vnode; + mp = vp->v_mount; fdrop(fp, td); - if (mp == NULL) + if (vp->v_iflag & VI_DOOMED) return (EBADF); mtx_lock(&Giant); #ifdef MAC