svn commit: r272931 - head/sys/fs/autofs

Edward Tomasz Napierala trasz at FreeBSD.org
Sat Oct 11 05:11:24 UTC 2014


Author: trasz
Date: Sat Oct 11 05:11:23 2014
New Revision: 272931
URL: https://svnweb.freebsd.org/changeset/base/272931

Log:
  Add assertion to catch duplicated notes.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/fs/autofs/autofs_vnops.c

Modified: head/sys/fs/autofs/autofs_vnops.c
==============================================================================
--- head/sys/fs/autofs/autofs_vnops.c	Sat Oct 11 04:57:17 2014	(r272930)
+++ head/sys/fs/autofs/autofs_vnops.c	Sat Oct 11 05:11:23 2014	(r272931)
@@ -504,9 +504,13 @@ autofs_node_new(struct autofs_node *pare
 {
 	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);


More information about the svn-src-head mailing list