Port-i386 archive

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

Two scenarios leading to filesystem corruption under NetBSD-4.0, anyone seen this?



        Hello.  I'm running NetBSD-4.0-stable on several systems, and I've
noticed two scenarios where files can become incredibly corrupt, perhaps
they're related, perhaps not, I'm not sure.
        Has anyone else run into these problems, and, if so, did you have a
fix, or maybe shed some light on the trouble?

1.  When writing to an msdos based filesystem, FAT16 in my case, I've found
that if I have two processes writing to the filesystem at the same time,
the files those processes are writing can become intermingled.
        the intermingling is not interleaved.  Rather, the end of each file is
appended with the contents of something that the other process was writing.
It's almost as if the process finishes writing a file, closes it, and then
as the ioflush routines come along and flush things to the media, those
routines mix what was in  the buffers for one file with what was in the
buffers for the other writing process.  
        How to repeat:

A.  Start writing to an msdos based filesystem.

B.  Start  a new process writing to the same msdos filesystem.

I think you'll find that the files created with process A will have blocks
missing at their ends and instead will have blocks from process B.  I also
think you'll find the reverse is true for process B, though I'm not done with my
investigations.

2.  Writing files to a USB flash drive when it is mounted as root causes
those files to be corrupt.
        
If you boot NetBSD-4 from a USB flash key, and then try to write a file to
the boot key, you'll find the system doesn't properly save the file to the
flash.
        How to repeat:

A.  Boot a system from a flash key and mount that flash key as root.

B.  Copy a file from the flash key to another file on the flash key.

C.  Compare the two files -- they'll compare cleanly.

D.  Sync and reboot the system from the flash key.

E.  Re-compare the two files.  They'll differ.


        As I write this, it occurs to me that perhaps the commonality here
is the USB interconnect.  In the first scenario, I'm using a CF reader to
write to a CF card.  This CF reader is connected via a USB 1.0 port.  In
the second scenario, I'm using a USB thumb drive of some kind.  The second
scenario can be extended to a third by connecting a USB thumb drive to a
USB 2.0 port.  I've found that writing files over USB-2.0 is frought with
difficulties.

        Any thoughts?  Could these be related?


-thanks
-Brian


Home | Main Index | Thread Index | Old Index