diff options
author | trasz <trasz@FreeBSD.org> | 2014-10-11 05:11:23 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2014-10-11 05:11:23 +0000 |
commit | b24bb0c43503d27cd343707cbcf608e0d7c92dfe (patch) | |
tree | e0e4640ddfb978c9f04b5385fa7e0aa0098e62ff /sys/fs/autofs | |
parent | 358ea67a98884a4c8b36dfee13d01bcaa514a56c (diff) | |
download | FreeBSD-src-b24bb0c43503d27cd343707cbcf608e0d7c92dfe.zip FreeBSD-src-b24bb0c43503d27cd343707cbcf608e0d7c92dfe.tar.gz |
Add assertion to catch duplicated notes.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/fs/autofs')
-rw-r--r-- | sys/fs/autofs/autofs_vnops.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/fs/autofs/autofs_vnops.c b/sys/fs/autofs/autofs_vnops.c index a3ae3a9..550c514 100644 --- a/sys/fs/autofs/autofs_vnops.c +++ b/sys/fs/autofs/autofs_vnops.c @@ -504,9 +504,13 @@ autofs_node_new(struct autofs_node *parent, struct autofs_mount *amp, { struct autofs_node *anp; - if (parent != NULL) + if (parent != NULL) { AUTOFS_ASSERT_XLOCKED(parent->an_mount); + KASSERT(autofs_node_find(parent, name, namelen, NULL) == ENOENT, + ("node \"%s\" already exists", name)); + } + anp = uma_zalloc(autofs_node_zone, M_WAITOK | M_ZERO); if (namelen >= 0) anp->an_name = strndup(name, namelen, M_AUTOFS); |