From: sct@dcs.ed.ac.uk (Stephen Tweedie) Subject: Re: No sync in linux DOS file system ?? Date: 17 May 1993 20:33:00 GMT
On 16 May 93 05:58:55 GMT, dhliu@solar.csie.ntu.edu.tw (Der-Hua Liu) said:
> If you have tried dosemu, you will find this problem. If you copy some files
> to a dos file system, use the sync command and copy and bring the dosemu up,
> you will find the files is not in the dos drive.
Are you trying to access a single partition simultaneously through the
dos emulator and a mounted msdos filesystem? This is dangerous in a
*BIG* way! The trouble is that if you have, say, /dev/hda1 mounted in
the Linux directory tree as an msdos partition, the dos emulator
itself will use /dev/hda (ie. the image of the _entire_ hard disk) to
access it, rather than /dev/hda1 (the image of the single partition).
Anyway, to cut a long story short, this means that the same physical
disk blocks will be being accessed through two entirely different
logical devices, and there is absolutely no coordination between them.
You can seriously corrupt your filesystem doing this.
*NEVER* run dosemu-0.48 or older on a mounted msdos partition, unless
you use the dos redirector to access it through the linux filesystem
code.
Dosemu-0.49 will not have this problem - you will be able to mount a
single partition as a dos disk. However, it will still be dangerous,
since DOS does its own limited caching of disk blocks (the "BUFFERS"
command in the config.sys sets this up), and there is no interaction
between this cache and Linux's internal cache.
If you do really want to run dos on a Linux-mounted dos partition, do
it with the dosemu filesystem redirector, to make the Linux filesystem
tree appear under dos. The redirector in dosemu-0.49 will be very
much better than the old linux.exe under dosemu-0.48.
> I have also traced the Mach2.6's VFS and NFS. Each file system type
> has its own vfs_sync function. The sync() system call calls each
> file system type's vfs_sync function one by one. Maybe it is
> different from Linux's.
Yes; the block device buffering code in Linux is entirely separate
from the filesystem code. There is a filesystem hook to write dirty
inodes or superblock information, but there are no hooks to let a
filesystem participate in the buffering or writing out of dirty
blocks.
Cheers,
Stephen Tweedie.