Date: Sat, 22 Jan 2000 08:39:27 -0800 (PST) From: peter.edwards@ireland.com To: freebsd-gnats-submit@FreeBSD.org Subject: kern/16299: nfs.ko can be unloaded when nfsd is running, leading to a panic later Message-ID: <20000122163927.163A614E1D@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 16299
>Category: kern
>Synopsis: nfs.ko can be unloaded when nfsd is running, leading to a panic later
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Jan 22 08:40:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Peter Edwards
>Release: -current (~Jan 18 2000)
>Organization:
>Environment:
FreeBSD 4.0-CURRENT #0: Wed Jan 19 19:12:52 GMT 2000
>Description:
You can unload the nfs module while nfsd is running
When nfsd dies later, you will probably end up panicing.
>How-To-Repeat:
# kldunload nfs
# ps ax | awk '/nfsd/ { print $1 }' | xargs kill -9
>Fix:
Patches: (sorry for cut-n-paste whitespace, but I've no MX available to
send a proper mail. Anyway, the change is pretty small..)
*** nfs_syscalls.c.old Sat Jan 22 16:15:02 2000
--- nfs_syscalls.c Sat Jan 22 16:24:36 2000
***************
*** 103,108 ****
--- 103,109 ----
#ifndef NFS_NOSERVER
int nfsd_waiting = 0;
+ int nfs_server_daemons; /* number of active nfsd processes. */
static struct nfsdrt nfsdrt;
static int nfs_numnfsd = 0;
static int notstarted = 1;
***************
*** 303,309 ****
--- 304,312 ----
}
if ((uap->flag & NFSSVC_AUTHINFAIL) && (nfsd = nsd->nsd_nfsd))
nfsd->nfsd_flag |= NFSD_AUTHFAIL;
+ nfs_server_daemons++;
error = nfssvc_nfsd(nsd, uap->argp, p);
+ nfs_server_daemons--;
}
#endif /* NFS_NOSERVER */
if (error == EINTR || error == ERESTART)
*** nfs_subs.c.old Sat Jan 22 16:15:02 2000
--- nfs_subs.c Sat Jan 22 16:26:17 2000
***************
*** 150,155 ****
--- 150,157 ----
NFSPROC_NOOP
};
+ extern int nfs_server_daemons;
+
#endif /* NFS_NOSERVER */
/*
* and the reverse mapping from generic to Version 2 procedure numbers
***************
*** 1183,1188 ****
--- 1185,1192 ----
untimeout(nfs_timer, (void *)NULL, nfs_timer_handle);
nfs_mount_type = -1;
#ifndef NFS_NOSERVER
+ if (nfs_server_daemons)
+ return EBUSY;
default_vnodeop_p[VOFFSET(vop_lease)] = nfs_prev_vop_lease_check;
#endif
lease_updatetime = nfs_prev_lease_updatetime;
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000122163927.163A614E1D>
