summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2008-02-15 11:58:11 +0000
committerrwatson <rwatson@FreeBSD.org>2008-02-15 11:58:11 +0000
commitac6e0fc083e9cc7f7d14c0eea72af8a0b59266b0 (patch)
tree3b023325ee010bad52f06f6b126b55bc05d304b6 /sys/fs
parentfebd0ab45ed442b3d2823f2f18188e9f3ef4a5ea (diff)
downloadFreeBSD-src-ac6e0fc083e9cc7f7d14c0eea72af8a0b59266b0.zip
FreeBSD-src-ac6e0fc083e9cc7f7d14c0eea72af8a0b59266b0.tar.gz
Reorder and clean up make_coda_node(), annotate weaknesses in the
implementation. MFC after: 1 month
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/coda/coda_vnops.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c
index d6e3429..a24a9aa 100644
--- a/sys/fs/coda/coda_vnops.c
+++ b/sys/fs/coda/coda_vnops.c
@@ -1692,29 +1692,34 @@ struct cnode *
make_coda_node(CodaFid *fid, struct mount *vfsp, short type)
{
struct cnode *cp;
+ struct vnode *vp;
int err;
- if ((cp = coda_find(fid)) == NULL) {
- struct vnode *vp;
-
- cp = coda_alloc();
- cp->c_fid = *fid;
- err = getnewvnode("coda", vfsp, &coda_vnodeops, &vp);
- if (err)
- panic("coda: getnewvnode returned error %d\n", err);
-
- /*
- * XXX: Too early for mpsafe fs.
- */
- err = insmntque1(vp, vfsp, NULL, NULL);
- if (err != 0)
- panic("coda: insmntque failed: error %d", err);
- vp->v_data = cp;
- vp->v_type = type;
- cp->c_vnode = vp;
- coda_save(cp);
- } else
+ /*
+ * XXXRW: This really needs a moderate amount of reworking. We need
+ * to properly tolerate failures of getnewvnode() and insmntque(),
+ * and callers need to be able to accept an error back from
+ * make_coda_node. There may also be more general issues in how we
+ * handle forced unmount. Finally, if/when Coda loses its dependency
+ * on Giant, the ordering of this needs rethinking.
+ */
+ cp = coda_find(fid);
+ if (cp != NULL) {
vref(CTOV(cp));
+ return (cp);
+ }
+ cp = coda_alloc();
+ cp->c_fid = *fid;
+ err = getnewvnode("coda", vfsp, &coda_vnodeops, &vp);
+ if (err)
+ panic("coda: getnewvnode returned error %d\n", err);
+ vp->v_data = cp;
+ vp->v_type = type;
+ cp->c_vnode = vp;
+ coda_save(cp);
+ err = insmntque(vp, vfsp);
+ if (err != 0)
+ printf("coda: insmntque failed: error %d", err);
return (cp);
}
OpenPOWER on IntegriCloud