misc/93435: kernel panic after setting big value of tunefs -f and -s

Ilya Danilyuk furcube at gmail.com
Thu Feb 16 06:50:10 PST 2006


>Number:         93435
>Category:       misc
>Synopsis:       kernel panic after setting big value of tunefs -f and -s
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 16 14:50:09 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Ilya Danilyuk
>Release:        6.0
>Organization:
>Environment:
FreeBSD mr114-121.lan 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #0: Tue Feb 14 23:42:40 MSK 2006     ilya at mr114-121.lan:/usr/src/obj/usr/src/sys/SERV_DBG  i386

>Description:
I cvsup'd kernel and built it with DDB.

After altering tunefs' options (setting average file size to 200M and average files per directory to 40)
tunefs -f 209715200 -s 40

i've got a kernel panic:

Fatal trap 18: integer divide fault while in kernel mode
instruction pointer     = 0x20:0xc0602d2d
stack pointer           = 0x28:0xda9c293c
frame pointer           = 0x28:0xda9c2978
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, def32 1, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 4933 (pure-ftpd)

part of trace report of ddb (simplified):
ffs_dirpref(c35608c4,da9c2c14,da9c2c00,3fff,200) + 0x22d
ffs_valloc+0x9f
VOP_MKDIR_APV+0x3e
kern_mkdir+0x3af

it seems like problem is here:
ffs_alloc.c
line 1051

	dirsize = fs->fs_avgfilesize * fs->fs_avgfpdir;
	curdirsize = avgndir ? (cgsize - avgbfree * fs->fs_bsize) / avgndir : 0;
	if (dirsize < curdirsize)
		dirsize = curdirsize;
	maxcontigdirs = min((avgbfree * fs->fs_bsize) / dirsize, 255);

dirsize is 32-bit, but result of 200M*40 is 33 bit
>How-To-Repeat:
use tunefs with big average file size and average files per dir
and create directories and files on volume (sometimes there's no error)

for example
tunefs -f 209715200 -s 40 /volume
and then mkdir /something ; mkdir -p /something1/somth3  e.t.c.

>Fix:
maybe change integers to uint64...
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list