diff options
author | tegge <tegge@FreeBSD.org> | 2007-03-13 01:50:27 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 2007-03-13 01:50:27 +0000 |
commit | 214bc5723c38739a6060170f2c421e59d87b2c82 (patch) | |
tree | 6dca3f2c99e6dcb6402e1486118e56eb8d5e871b /sys/ufs | |
parent | 76cbc46fe707603a2b4dde9cc8398128868b56ee (diff) | |
download | FreeBSD-src-214bc5723c38739a6060170f2c421e59d87b2c82.zip FreeBSD-src-214bc5723c38739a6060170f2c421e59d87b2c82.tar.gz |
Make insmntque() externally visibile and allow it to fail (e.g. during
late stages of unmount). On failure, the vnode is recycled.
Add insmntque1(), to allow for file system specific cleanup when
recycling vnode on failure.
Change getnewvnode() to no longer call insmntque(). Previously,
embryonic vnodes were put onto the list of vnode belonging to a file
system, which is unsafe for a file system marked MPSAFE.
Change vfs_hash_insert() to no longer lock the vnode. The caller now
has that responsibility.
Change most file systems to lock the vnode and call insmntque() or
insmntque1() after a new vnode has been sufficiently setup. Handle
failed insmntque*() calls by propagating errors to callers, possibly
after some file system specific cleanup.
Approved by: re (kensmith)
Reviewed by: kib
In collaboration with: kib
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 788eb2f..7af15dd 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1327,6 +1327,7 @@ ffs_vget(mp, ino, flags, vpp) struct vnode *vp; struct cdev *dev; int error; + struct thread *td; error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL); if (error || *vpp != NULL) @@ -1391,7 +1392,15 @@ ffs_vget(mp, ino, flags, vpp) } #endif - error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL); + td = curthread; + lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL, td); + error = insmntque(vp, mp); + if (error != 0) { + uma_zfree(uma_inode, ip); + *vpp = NULL; + return (error); + } + error = vfs_hash_insert(vp, ino, flags, td, vpp, NULL, NULL); if (error || *vpp != NULL) return (error); |