From 214bc5723c38739a6060170f2c421e59d87b2c82 Mon Sep 17 00:00:00 2001 From: tegge Date: Tue, 13 Mar 2007 01:50:27 +0000 Subject: 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 --- sys/fs/portalfs/portal_vfsops.c | 7 +++++++ sys/fs/portalfs/portal_vnops.c | 5 +++++ 2 files changed, 12 insertions(+) (limited to 'sys/fs/portalfs') diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index db73ef0..412e81a 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -136,6 +136,13 @@ portal_mount(struct mount *mp, struct thread *td) return (error); } + error = insmntque(rvp, mp); /* XXX: Too early for mpsafe fs */ + if (error != 0) { + FREE(fmp, M_PORTALFSMNT); + FREE(pn, M_TEMP); + fdrop(fp, td); + return (error); + } rvp->v_data = pn; rvp->v_type = VDIR; rvp->v_vflag |= VV_ROOT; diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c index 143d634..d6c4bc5 100644 --- a/sys/fs/portalfs/portal_vnops.c +++ b/sys/fs/portalfs/portal_vnops.c @@ -154,6 +154,11 @@ portal_lookup(ap) *vpp = fvp; vn_lock(fvp, LK_EXCLUSIVE | LK_RETRY, td); + error = insmntque(fvp, dvp->v_mount); + if (error != 0) { + *vpp = NULLVP; + return (error); + } return (0); bad:; -- cgit v1.1