NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/45605: Data corruption with NILFS(2)



>Number:         45605
>Category:       kern
>Synopsis:       Data corruption when reading a NILFS(2) file system
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 12 13:55:00 +0000 2011
>Originator:     Gregoire Sutre
>Release:        NetBSD 5.99.56
>Organization:
>Environment:
System: NetBSD yosemite 5.99.56 NetBSD 5.99.56 (GENERIC) #0: Fri Nov 11 
17:26:37 CET 2011 
sutre@tahoe:/data/sutre/build-amd64/home/sutre/NetBSD/src/sys/arch/amd64/compile/GENERIC
 amd64
Architecture: x86_64
Machine: amd64
>Description:
I observed data corruption when reading files in a freshly created
NILFS(2) file system, stored on a USB key.  The NILFS(2) file system
was created and populated on a system running Debian GNU/Linux.

>How-To-Repeat:

>> Creation of the file system on Debian GNU/Linux <<

$ /sbin/fdisk -l /dev/sdf

Disk /dev/sdf: 2030 MB, 2030043136 bytes
44 heads, 10 sectors/track, 9011 cylinders, total 3964928 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xda754b80

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1            2048     1026047      512000   83  Linux

$ /sbin/mkfs.nilfs2 /dev/sdf1
mkfs.nilfs2 (nilfs-utils 2.1.0-rc2)
Start writing file system initial data to the device
       Blocksize:4096  Device:/dev/sdf1  Device Size:524288000
File system initialization succeeded !!

$ mount /dev/sdf1 /mnt/disk
$ pushd /mnt/disk
$ dd if=/dev/urandom of=rand.bin bs=2M count=1
$ i=1; while [ "$i" -le "10" ]; do cp -p rand.bin copy-$i.bin; i=$((i+1)); done
$ popd
$ umount /mnt/disk


>> Reading the file system on NetBSD <<

$ mount_nilfs /dev/sd0e /mnt/disk
$ cd /mnt/disk
$ i=1; while [ "$i" -le "10" ]; do cmp rand.bin copy-$i.bin; i=$((i+1)); done
rand.bin copy-1.bin differ: char 2095114, line 8235
rand.bin copy-2.bin differ: char 2095114, line 8235
rand.bin copy-3.bin differ: char 2095114, line 8235
rand.bin copy-4.bin differ: char 2095113, line 8235
rand.bin copy-5.bin differ: char 2095114, line 8235
rand.bin copy-6.bin differ: char 2095114, line 8235
rand.bin copy-7.bin differ: char 2095114, line 8235
rand.bin copy-8.bin differ: char 2095113, line 8235
rand.bin copy-9.bin differ: char 2095113, line 8235
rand.bin copy-10.bin differ: char 2095113, line 8235
$ cd
$ umount /mnt/disk


>> Checking that the file system reads fine on Debian GNU/Linux <<

$ mount /dev/sdf1 /mnt/disk
$ pushd /mnt/disk
$ i=1; while [ "$i" -le "10" ]; do cmp rand.bin copy-$i.bin; i=$((i+1)); done
$ popd
$ umount /mnt/disk


Note: testing with 1M random file (instead of 2M) does not trigger
the problem.

>Fix:

>Unformatted:
 Sources from 2011-11-11.


Home | Main Index | Thread Index | Old Index