From thomas@cuivre.fr.eu.org  Sun Dec 15 07:25:46 2002
Return-Path: <thomas@cuivre.fr.eu.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6D8F437B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 15 Dec 2002 07:25:46 -0800 (PST)
Received: from melusine.cuivre.fr.eu.org (melusine.cuivre.fr.eu.org [62.212.105.185])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A2C5243ED1
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 15 Dec 2002 07:25:45 -0800 (PST)
	(envelope-from thomas@cuivre.fr.eu.org)
Received: by melusine.cuivre.fr.eu.org (Postfix, from userid 1000)
	id 408D02C3D3; Sun, 15 Dec 2002 16:26:02 +0100 (CET)
Message-Id: <20021215152602.408D02C3D3@melusine.cuivre.fr.eu.org>
Date: Sun, 15 Dec 2002 16:26:02 +0100 (CET)
From: Thomas Quinot <thomas@freebsd.org>
Sender: thomas@cuivre.fr.eu.org
Reply-To: Thomas Quinot <thomas@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: RELENG_4 loader fails to load snd
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         46275
>Category:       kern
>Synopsis:       RELENG_4 loader fails to load snd
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    thomas
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 15 07:30:07 PST 2002
>Closed-Date:    Thu Dec 19 04:43:33 PST 2002
>Last-Modified:  Thu Dec 19 04:43:33 PST 2002
>Originator:     Thomas Quinot
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
>Environment:
System: FreeBSD melusine.cuivre.fr.eu.org 4.7-STABLE FreeBSD 4.7-STABLE #4: Sun Dec 15 13:52:26 CET 2002 thomas@melusine.cuivre.fr.eu.org:/usr2/obj/usr2/src/sys/MELUSINE i386


	
>Description:
	The RELENG_4 loader cannot load the snd module together
	with its dependencies using 'load snd' (or snd_load="YES")
	in loader.conf because the last module in the dependency graph
	(snd_pcm presumably) has already been loaded as a result
	of previous dependencies. The returned EEXIST error is erroneously
	propagated to the caller of file_load_dependencies.

	NB: I do not know what the situation with CURRENT is.

>How-To-Repeat:
	Type 'load snd' at the loader prompt with a kernel that does not
	have compiled-in sound drivers.
	The snd module and its dependencies will be loaded, but then
	a 'module is already loaded' message will be emitted, and all
	the newly-loaded modules will be discarded (as can be confirmed
	using lsmod).
>Fix:
	This patch against RELENG_4 appears to fix the problem for me;
	please review.

Index: module.c
===================================================================
RCS file: /home/ncvs/src/sys/boot/common/module.c,v
retrieving revision 1.13.2.3
diff -u -r1.13.2.3 module.c
--- module.c	12 Jun 2001 15:35:14 -0000	1.13.2.3
+++ module.c	15 Dec 2002 15:09:07 -0000
@@ -369,7 +369,9 @@
 	if (mod_findmodule(NULL, dmodname) == NULL) {
 	    printf("loading required module '%s'\n", dmodname);
 	    error = mod_load(dmodname, 0, NULL);
-	    if (error && error != EEXIST)
+	    if (error == EEXIST)
+		error = 0;
+	    if (error != 0)
 		break;
 	}
 	md = metadata_next(md, MODINFOMD_DEPLIST);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->thomas 
Responsible-Changed-By: thomas 
Responsible-Changed-When: Tue Dec 17 13:25:32 PST 2002 
Responsible-Changed-Why:  
I'll take this one, since I submitted it... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=46275 
State-Changed-From-To: open->closed 
State-Changed-By: thomas 
State-Changed-When: Thu Dec 19 04:41:44 PST 2002 
State-Changed-Why:  
Fixed in sys/boot/common/module.c rev. 1.13.2.4. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=46275 
>Unformatted:
	I cannot reproduce this problem with -current.
