Add assertion to catch duplicated notes.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2014-10-11 05:11:23 +00:00
parent 90a5222f14
commit 3e4adf76c4

View File

@ -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);