diff options
author | Pavel Filipensky <Pavel.Filipensky@Sun.COM> | 2009-05-19 16:14:12 +0100 |
---|---|---|
committer | Pavel Filipensky <Pavel.Filipensky@Sun.COM> | 2009-05-19 16:14:12 +0100 |
commit | c076b414ebb6fd85c5818858ff8c826ef9457449 (patch) | |
tree | 81b66a2031ac69d66664060bb7e717e5c113bf8a /usr | |
parent | 3d6926289465757c3da780cea696825b0d730283 (diff) | |
download | illumos-gate-c076b414ebb6fd85c5818858ff8c826ef9457449.tar.gz |
6840231 Panic in treeclimb_export()->checkexport4()
6840163 Variable treenode_t *ns_root should be declared as extern in export.h
6840149 "#define EXPTABLESIZE 16" is twice in the source
6834678 typo in /usr/include/nfs/export.h
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/uts/common/fs/nfs/nfs4_srv_ns.c | 34 | ||||
-rw-r--r-- | usr/src/uts/common/fs/nfs/nfs_export.c | 2 | ||||
-rw-r--r-- | usr/src/uts/common/nfs/export.h | 13 |
3 files changed, 25 insertions, 24 deletions
diff --git a/usr/src/uts/common/fs/nfs/nfs4_srv_ns.c b/usr/src/uts/common/fs/nfs/nfs4_srv_ns.c index 17f13008eb..40ef94e16b 100644 --- a/usr/src/uts/common/fs/nfs/nfs4_srv_ns.c +++ b/usr/src/uts/common/fs/nfs/nfs4_srv_ns.c @@ -18,12 +18,10 @@ * * CDDL HEADER END * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/systm.h> #include <nfs/nfs.h> @@ -647,18 +645,8 @@ treeclimb_export(struct exportinfo *exip) */ va.va_mask = AT_NODEID; error = VOP_GETATTR(vp, &va, 0, CRED(), NULL); - if (error) { - if (new_exi && new_exi != exip) { - /* - * This exportinfo is not connected with - * treenode yet. Free it here. - */ - (void) export_unlink(&new_exi->exi_fsid, - &new_exi->exi_fid, new_exi->exi_vp, NULL); - exi_rele(new_exi); - } + if (error) break; - } /* * Add this directory fid to visible list @@ -714,23 +702,29 @@ treeclimb_export(struct exportinfo *exip) * 2. pseudo_exportfs() which can fail only in vop_fid_pseudo() * 3. VOP_GETATTR() * 4. VOP_LOOKUP() - * To cleanup, free pseudo exportinfos, visibles and treenodes. + * We must free pseudo exportinfos, visibles and treenodes. + * Visibles are referenced from treenode_t::tree_vis and + * exportinfo_t::exi_visible. To avoid double freeing, only + * exi_visible pointer is used, via exi_rele(), for the clean-up. */ if (error) { + /* Free unconnected visibles, if there are any. */ + if (vis_head) + free_visible(vis_head); + + /* Connect unconnected exportinfo, if there is any. */ + if (new_exi && new_exi != exip) + tree_head = tree_prepend_node(tree_head, 0, new_exi); + while (tree_head) { treenode_t *t2 = tree_head; exportinfo_t *e = tree_head->tree_exi; - exp_visible_t *v = tree_head->tree_vis; /* exip will be freed in exportfs() */ if (e && e != exip) { (void) export_unlink(&e->exi_fsid, &e->exi_fid, e->exi_vp, NULL); exi_rele(e); } - if (v) { - VN_RELE(v->vis_vp); - kmem_free(v, sizeof (*v)); - } tree_head = tree_head->tree_child_first; kmem_free(t2, sizeof (*t2)); } diff --git a/usr/src/uts/common/fs/nfs/nfs_export.c b/usr/src/uts/common/fs/nfs/nfs_export.c index a2646ce627..6bd69dc5c3 100644 --- a/usr/src/uts/common/fs/nfs/nfs_export.c +++ b/usr/src/uts/common/fs/nfs/nfs_export.c @@ -64,7 +64,7 @@ #include <nfs/lm.h> #include <sys/sunddi.h> -#define EXPTABLESIZE 16 +treenode_t *ns_root; struct exportinfo *exptable[EXPTABLESIZE]; diff --git a/usr/src/uts/common/nfs/export.h b/usr/src/uts/common/nfs/export.h index 9e06cb5224..b66c00c389 100644 --- a/usr/src/uts/common/nfs/export.h +++ b/usr/src/uts/common/nfs/export.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -350,7 +350,7 @@ struct exp_visible; * treenode_t::tree_exi --------- exportinfo_t::exi_tree * treenode_t::tree_vis ......... exp_visible_t::vis_tree */ -/* Access to treenodei_t is under under protection of exported_lock RW_LOCK */ +/* Access to treenode_t is under protection of exported_lock RW_LOCK */ typedef struct treenode { /* support for generic n-ary trees */ struct treenode *tree_parent; @@ -373,7 +373,7 @@ typedef struct treenode { ((t)->tree_exi && !PSEUDO((t)->tree_exi)) /* Root of nfs pseudo namespace */ -treenode_t *ns_root; +extern treenode_t *ns_root; #define EXPTABLESIZE 16 @@ -437,6 +437,13 @@ typedef struct secinfo secinfo_t; * The vis_count field records the number of paths in this filesystem * that use this directory. The vis_exported field is non-zero if the * entry is an exported directory (leaf node). + * + * exp_visible itself is not reference counted. Each exp_visible is + * referenced twice: + * 1) from treenode::tree_vis + * 2) linked from exportinfo::exi_visible + * The 'owner' of exp_visible is the exportinfo structure. exp_visible should + * be always freed only from exportinfo_t, never from treenode::tree_vis. */ struct exp_visible { |