Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Feb 2013 18:46:56 +0000 (UTC)
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r247486 - stable/9/sys/kern
Message-ID:  <201302281846.r1SIkuFK004917@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jamie
Date: Thu Feb 28 18:46:56 2013
New Revision: 247486
URL: http://svnweb.freebsd.org/changeset/base/247486

Log:
  MFC r247071:
  
    Don't worry if a module is already loaded when looking for a fstype to mount
    (possible in a race condition).
  
  Reviewed by:	kib

Modified:
  stable/9/sys/kern/vfs_init.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/vfs_init.c
==============================================================================
--- stable/9/sys/kern/vfs_init.c	Thu Feb 28 18:43:50 2013	(r247485)
+++ stable/9/sys/kern/vfs_init.c	Thu Feb 28 18:46:56 2013	(r247486)
@@ -122,7 +122,7 @@ struct vfsconf *
 vfs_byname_kld(const char *fstype, struct thread *td, int *error)
 {
 	struct vfsconf *vfsp;
-	int fileid;
+	int fileid, loaded;
 
 	vfsp = vfs_byname(fstype);
 	if (vfsp != NULL)
@@ -130,13 +130,17 @@ vfs_byname_kld(const char *fstype, struc
 
 	/* Try to load the respective module. */
 	*error = kern_kldload(td, fstype, &fileid);
+	loaded = (*error == 0);
+	if (*error == EEXIST)
+		*error = 0;
 	if (*error)
 		return (NULL);
 
 	/* Look up again to see if the VFS was loaded. */
 	vfsp = vfs_byname(fstype);
 	if (vfsp == NULL) {
-		(void)kern_kldunload(td, fileid, LINKER_UNLOAD_FORCE);
+		if (loaded)
+			(void)kern_kldunload(td, fileid, LINKER_UNLOAD_FORCE);
 		*error = ENODEV;
 		return (NULL);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302281846.r1SIkuFK004917>