Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: modular nfsserver hanging from mountd



On Fri Nov 28 2008 at 12:08:26 +1100, Geoff Wing wrote:
> With a kernel which autoloads the nfsserver (which autoloads nfs), mountd
> hangs during a nfs syscall.  ktrace says:
> 
>    112      1 mountd   CALL  nfssvc(0x200,0xbfbfdf30)
>    112      1 mountd   NAMI  
> "/stand/i386/5.99.3/modules/nfsserver/nfsserver.kmod"
>    112      1 mountd   NAMI  "/stand/i386/5.99.3/modules/nfs/nfs.kmod"
>    112      1 mountd   RET   nfssvc RESTART
>    112      1 mountd   CALL  nfssvc(0x200,0xbfbfdf30)
>    112      1 mountd   NAMI  "/"
> 
> It hangs in src/sys/nfs/nfs_export.c:init_exports() on
>       ne = malloc(sizeof(*ne), M_NFS_EXPORT, M_WAITOK | M_ZERO);
> 
> Is the problem obvious to anyone?
> 
> Building NFSSERVER into the kernel works properly (still).

One obvious problem is that the M_NFS_EXPORT type is never attached
(unless modules for some reason attach malloc types automatically,
didn't check).

Try if this very much untested patch gets you any further.
Index: nfs_export.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_export.c,v
retrieving revision 1.42
diff -p -u -r1.42 nfs_export.c
--- nfs_export.c        25 Nov 2008 14:28:42 -0000      1.42
+++ nfs_export.c        28 Nov 2008 06:44:05 -0000
@@ -123,9 +123,6 @@ struct netexport {
 CIRCLEQ_HEAD(, netexport) netexport_list =
     CIRCLEQ_HEAD_INITIALIZER(netexport_list);
 
-/* Malloc type used by the mount<->netexport map. */
-MALLOC_DEFINE(M_NFS_EXPORT, "nfs_export", "NFS export data");
-
 /* Publicly exported file system. */
 struct nfs_public nfs_pub;
 
@@ -189,7 +186,7 @@ nfs_export_unmount(struct mount *mp)
        netexport_clear(ne);
        netexport_remove(ne);
        netexport_wrunlock();
-       free(ne, M_NFS_EXPORT);
+       kmem_free(ne, sizeof(*ne));
 }
 
 /*
@@ -431,7 +428,7 @@ init_exports(struct mount *mp, struct ne
        /* Ensure that we do not already have this mount point. */
        KASSERT(netexport_lookup(mp) == NULL);
 
-       ne = malloc(sizeof(*ne), M_NFS_EXPORT, M_WAITOK | M_ZERO);
+       ne = kmem_zalloc(sizeof(*ne), KM_SLEEP);
        ne->ne_mount = mp;
 
        /* Set the default export entry.  Handled internally by export upon
@@ -442,7 +439,7 @@ init_exports(struct mount *mp, struct ne
                ea.ex_flags |= MNT_EXRDONLY;
        error = export(ne, &ea);
        if (error != 0) {
-               free(ne, M_NFS_EXPORT);
+               kmem_free(ne, sizeof(*ne));
        } else {
                netexport_insert(ne);
                *nep = ne;


Home | Main Index | Thread Index | Old Index