Bug 94830

Summary: [nfs] [patch] mount_nfs causes a fatal trap 18 if the value of desiredvnodes is below 1000
Product: Base System Reporter: Fabian Keil <freebsd-listen>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me CC: fk
Priority: Normal Keywords: patch
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Fabian Keil 2006-03-22 14:10:18 UTC
On a Pentium 90 with 16 MB RAM FreeBSD sets desiredvnodes to 926,
this leads to a panic (Fatal trap 18: integer divide fault while in
kernel mode) if mount_nfs is used.

The panic is caused by line 826 in /usr/src/sys/nfsclient/nfs_vfsops.c:
nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000);

desiredvnodes is an integer value, if it is divided by a value
bigger than itself the result is zero.

Kernel configuration:
http://www.fabiankeil.de/tmp/casablanca/CASABLANCA

dmesg:
http://www.fabiankeil.de/tmp/casablanca/dmesg.boot

kgdb backtrace:
http://www.fabiankeil.de/tmp/casablanca/backtrace.txt

Fix: 

Increase kern.maxvnodes by hand or let
http://www.fabiankeil.de/sourcecode/nfs_vfsops.c.patch
do the job.

I'm not sure if ignoring the kernel's calculations is the right
thing to do, but so far I didn't experience any ill side effects.
How-To-Repeat: Use mount_nfs on a machine with a desiredvnodes value below 1000
(or set sysctl kern.maxvnodes to a value below 1000 yourself).
Comment 1 cel freebsd_committer freebsd_triage 2006-05-24 20:43:31 UTC
Responsible Changed
From-To: freebsd-bugs->cel

Will review how nm_wcommitsize is calculated.
Comment 2 cel freebsd_committer freebsd_triage 2007-03-12 15:25:32 UTC
Responsible Changed
From-To: cel->freebsd-bugs

Back to the public pool.
Comment 3 Fabian Keil 2014-12-28 15:41:44 UTC
The offending code got removed in r276096.
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:52:30 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"
Comment 5 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:38:53 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>