Subject: kern/14759: kernel diagnostic assertion failure in genfs_putpages
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jandberg@netbsd.org>
List: netbsd-bugs
Date: 11/25/2001 14:47:12
>Number:         14759
>Category:       kern
>Synopsis:       kernel diagnostic assertion failure in genfs_putpages
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 28 05:43:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jukka Andberg
>Release:        -current ~ 20011122
>Organization:
>Environment:
System: NetBSD garganplex 1.5Y NetBSD 1.5Y (GARGANPLEX) #22: Sat Nov 24 13:05:53 EET 2001 root@garganplex:/usr/src/sys/arch/amiga/compile/GARGANPLEX amiga
Architecture: m68k
Machine: amiga
>Description:
Panics like these have been appearing lately.

panic: kernel diagnostic assertion "(startoff & PAGE_MASK) == 0 && (endoff & PAGE_MASK) == 0" failed: file "../../../../miscfs/genfs/genfs_vnops.c", line 1030

_genfs_putpages
_ffs_write
_vn_write
_dofilewrite
_sys_write
_syscall
_trap

Quick examination reveals:
- genfs_putpages expects startoff/endoff to be multiples of page size
- ffs_write rounds these to fs_bsize in some cases
- page size is 8192
- fs_bsize is 4096

>How-To-Repeat:
	Run the following program. If the file created is on a fs with
	block size 4096 the panic appears. The O_SYNC flag triggers
	the faulty code path in ffs_write.

#include <fcntl.h>

int
main(int argc, char ** argv)
{
	int fd = open ("/var/test", O_WRONLY|O_CREAT|O_SYNC, 0);
	write (fd, "Hello", 5);
	close (fd);
}
	
>Fix:
	-

>Release-Note:
>Audit-Trail:
>Unformatted: