aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/msdosfs/msdosfs_denode.c
diff options
context:
space:
mode:
authorTor Egge <tegge@FreeBSD.org>2007-03-13 01:50:27 +0000
committerTor Egge <tegge@FreeBSD.org>2007-03-13 01:50:27 +0000
commit61b9d89ff0a7d4c7bcea7fd083db918e16de41a5 (patch)
tree6dca3f2c99e6dcb6402e1486118e56eb8d5e871b /sys/fs/msdosfs/msdosfs_denode.c
parent06e83c7e86824a2bf64e797dca3cf56e60ac3e85 (diff)
downloadsrc-61b9d89ff0a7d4c7bcea7fd083db918e16de41a5.tar.gz
src-61b9d89ff0a7d4c7bcea7fd083db918e16de41a5.zip
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
Notes
Notes: svn path=/head/; revision=167497
Diffstat (limited to 'sys/fs/msdosfs/msdosfs_denode.c')
-rw-r--r--sys/fs/msdosfs/msdosfs_denode.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c
index 726f7a0630cf..3c8970d9b8ab 100644
--- a/sys/fs/msdosfs/msdosfs_denode.c
+++ b/sys/fs/msdosfs/msdosfs_denode.c
@@ -107,6 +107,7 @@ deget(pmp, dirclust, diroffset, depp)
struct denode *ldep;
struct vnode *nvp, *xvp;
struct buf *bp;
+ struct thread *td;
#ifdef MSDOSFS_DEBUG
printf("deget(pmp %p, dirclust %lu, diroffset %lx, depp %p)\n",
@@ -172,7 +173,15 @@ deget(pmp, dirclust, diroffset, depp)
ldep->de_inode = inode;
fc_purge(ldep, 0); /* init the fat cache for this denode */
- error = vfs_hash_insert(nvp, inode, LK_EXCLUSIVE, curthread, &xvp,
+ td = curthread;
+ lockmgr(nvp->v_vnlock, LK_EXCLUSIVE, NULL, td);
+ error = insmntque(nvp, mntp);
+ if (error != 0) {
+ FREE(ldep, M_MSDOSFSNODE);
+ *depp = NULL;
+ return (error);
+ }
+ error = vfs_hash_insert(nvp, inode, LK_EXCLUSIVE, td, &xvp,
de_vncmpf, &inode);
if (error) {
*depp = NULL;