tech-kern archive

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

Problem with autounload of nfsserver module

I believe that the nfsserver module should not be allowed to autounload.

Consider the following sequence of events:

1. mountd is started, and calls nfssvc(2)
2. The module subsystem autoloads the nfsserver module
3. mountd continues, adding entries to the exports list

So far, everything is fine.  However....

4. When the autounload timer expires, the module subsystem unloads the
   nfsserver module
5. As part of nfsserver_modcmd(), the export list is cleared
6. The autounload completes successfully
7. At some later time, we finally get around to starting nfsd.  This
   succeeds, but the export list has been cleared, so there is nothing
   for nfsd to deliver to the clients.

So, depending on how much time it takes between starting mountd and starting nfsd, we could end up serving an empty exports list.

The following patch prevents the module subsystem from unloading the nfsserver module. (Manual unloading of the module will still work.) Comments?

Index: nfs_serv.c
RCS file: /cvsroot/src/sys/nfs/nfs_serv.c,v
retrieving revision 1.166
diff -u -p -r1.166 nfs_serv.c
--- nfs_serv.c  14 Sep 2013 22:29:08 -0000      1.166
+++ nfs_serv.c  14 Dec 2013 13:51:40 -0000
@@ -144,6 +144,8 @@ nfsserver_modcmd(modcmd_t cmd, void *arg
                return 0;
+               return EBUSY;
                return ENOTTY;

| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at |
| Kernel Developer |                          | pgoyette at  |

Home | Main Index | Thread Index | Old Index