From owner-freebsd-bugs Sat Jan 22 8:40: 6 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 44F9214E6A for ; Sat, 22 Jan 2000 08:40:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id IAA66601; Sat, 22 Jan 2000 08:40:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 163A614E1D; Sat, 22 Jan 2000 08:39:27 -0800 (PST) Message-Id: <20000122163927.163A614E1D@hub.freebsd.org> Date: Sat, 22 Jan 2000 08:39:27 -0800 (PST) From: peter.edwards@ireland.com To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/16299: nfs.ko can be unloaded when nfsd is running, leading to a panic later Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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