Is mmap() broken for files kept on ext2fs?

Wojciech A. Koszek dunstan at freebsd.czest.pl
Mon Aug 15 19:49:23 GMT 2005


Hello,
I get easily repeatable problem with mmap(). Is file lies on Ext2
filesystem, I get EINVAL. In order to confirm it, could someone try to copy
files from Ext2fs to UFS (/bin/cp compiled with
-DVM_AND_BUFFER_CACHE_SYNCHRONIZED, which is default).

Additionally:
http://freebsd.czest.pl/dunstan/FreeBSD/mmapfile/mmapfile.c

[..]
mdconfig -a -t malloc -s 10m
md1
# mkfs.ext2 /dev/md1
mke2fs 1.38 (30-Jun-2005)
[..]
# mount_ext2fs /dev/md1 /mnt

# dd if=/dev/zero of=/mnt/somefile
3018+0 records in
3017+0 records out
1544704 bytes transferred in 0.073870 secs (20911130 bytes/sec)
# ls /mnt/somefile 
12 -rw-r--r--  1 root  wheel  1545216 Aug 15 21:45 /mnt/somefile
# ./mmapfile /mnt/somefile 
mmapfile: mmap(): Invalid argument

- 
* Wojciech A. Koszek && dunstan at FreeBSD.czest.pl


More information about the freebsd-current mailing list