[DragonFlyBSD - Bug #3237] msdosfs: can't properly read files longer than couple of kilobytes

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Wed Jun 3 14:39:22 PDT 2020


Issue #3237 has been updated by piecuch.

File first-ununiq.svg added
File second-ununiq.svg added
File third-ununiq.svg added

fsck doesn't complain.

> inmemory buffer for data is somehow not landing ondisk

I don't think this is true - the data written on DFly looks fine on Linux & FreeBSD. Data written on Linux cannot be read correctly on DFly.

1) Will try to bisect it

2) I've tested it the following way (using sh)

```
# newfs_msdos -u 1 -F 32 -c 2 /dev/vkd0s0d
/dev/vkd0s0d: 1016030 sectors in 508015 FAT32 clusters (1024 bytes/cluster)
BytesPerSec=512 SecPerClust=2 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=1 Heads=1 HiddenSecs=0 HugeSectors=1024000 FATsecs=3969 RootCluster=2 FSInfo=1 Backup=2
# mount /dev/vkd0s0d /test
# cd /test
# for i in $(seq 10000); do yes | head -n$i | tr -d '\n' > $i; done
# rm -r ../gut; mkdir ../gut # UFS partition
# reboot
# mount /dev/vkd0s0d /test
# cd /test
# for i in $(seq 10000); do cat $i | tr -d '\0' > ../gut/$i; done;
# cd ../gut/
# for i in $(seq 10000); do printf "expected %s, actual %s\n" $i $(cat $i | wc -c); done > all
# uniq -c -f 2 all > first-test

# newfs_msdos -u 1 -F 32 -c 4 /dev/vkd0s0d
/dev/vkd0s0d: 1019980 sectors in 254995 FAT32 clusters (2048 bytes/cluster)
BytesPerSec=512 SecPerClust=4 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=1 Heads=1 HiddenSecs=0 HugeSectors=1024000 FATsecs=1993 RootCluster=2 FSInfo=1 Backup=2
# mount /dev/vkd0s0d /test
# cd /test
# for i in $(seq 10000); do yes | head -n$i | tr -d '\n' > $i; done
# rm -r ../gut; mkdir ../gut #UFS
# reboot
# mount /dev/vkd0s0d /test
# cd /test
# for i in $(seq 10000); do cat $i | tr -d '\0' > ../gut/$i; done;
# cd ../gut/
# for i in $(seq 10000); do printf "expected %s, actual %s\n" $i $(cat $i | wc -c); done > all
# uniq -c -f 2 all > second-test


# newfs_msdos -F 32 -S 2048 -c 1 -u 1 /dev/vkd0s0d
/dev/vkd0s0d: 254994 sectors in 254994 FAT32 clusters (2048 bytes/cluster)
BytesPerSec=2048 SecPerClust=1 ResSectors=8 FATs=2 Media=0xf0 SecPerTrack=1 Heads=1 HiddenSecs=0 HugeSectors=256000 FATsecs=499 RootCluster=2 FSInfo=1 Backup=2
# mount /dev/vkd0s0d /test
# cd /test
# for i in $(seq 10000); do yes | head -n$i | tr -d '\n' > $i; done
# rm -r ../gut; mkdir ../gut #UFS
# reboot
# mount /dev/vkd0s0d /test
# cd /test
# for i in $(seq 10000); do cat $i | tr -d '\0' > ../gut/$i; done;
# cd ../gut/
# for i in $(seq 10000); do printf "expected %s, actual %s\n" $i $(cat $i | wc -c); done > all
```

You can find the plotted results in the attachments.

----------------------------------------
Bug #3237: msdosfs: can't properly read files longer than couple of kilobytes
http://bugs.dragonflybsd.org/issues/3237#change-13887

* Author: piecuch
* Status: New
* Priority: Normal
* Assignee: 
* Category: Other
* Target version: master
----------------------------------------
Reading a file from msdosfs reports valid data within the first couple of kilobytes, everything after that is only NULL bytes (or it might be some data from a different sector which is currently zeroed).

I have tested this on the following configurations:
write on Linux - corrupted data on dfly, correct data on Linux
write on dfly - corrupted data on dfly, correct data on Linux

I am running latest version from master.

I will see if this bug can be reproduced on freebsd and try to fix that/port stuff from freebsd. Hints welcome.

---Files--------------------------------
first-ununiq.svg (1.01 MB)
second-ununiq.svg (1.03 MB)
third-ununiq.svg (1010 KB)


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account


More information about the Bugs mailing list