Oliver Fromme wrote: > Momchil Ivanov wrote: > > On Wednesday 18 July 2007 15:52:42 [LoN]Kamikaze wrote: > > > Josh Paetzel wrote: > > > > Yes, it's expected behavior. The workaround is to not unplug mounted > > > > devices. (There's nothing special about USB here, if you unplugged an > > > > IDE drive you'd get the same behavior) > > > > > > Wouldn't it make some sense not to panic if mounted devices that are in > > > sync get removed? A few applications might get in trouble, but that's > > > hardly a reason to bring a whole system down. > > > > I don`t know how things work, but shutting down the system when some > > mounted fs is no longer present seems like the wrong thing to me. > > As Josh wrote, it's expected. The problem is known > to exist for a long time already (probably as long > as FreeBSD itself exists), and if there was an easy > solution, certainly someone would have fixed it.
I have to check this, but AFAIK this problem exists only for devices/partitions that are mounted R/W. Do you happen to know this? (I can not risk to crash my box right now for a test ;-) There once was an autofs implementation, but IIRC it has later been removed. It could not only automatically mount removable media, but it could also help with the problem of devices that are rarely written to, but still mounted R/W just in case for easy write-access. Long time ago I had the idea that a clean file system could be mounted R/O after a short delay. When all dirty buffers are flushed, the device could be forcefully disconnected without causing inconsistencies in the kernel. If there are no open file descriptors, the super-block could be written with the "clean" flag set, to signal that no fsck is needed when the partition is mounted next time. Internally, the device can be treated as R/O, with the only exeption that an attempted write is not rejected, but that it instead triggers the change back to R/W operation (this means setting the in-RAM copy of the super-block to dirty before the write is allowed to proceed as normal). Removable devices and dealing with a device that is gone and re-appears (either the same device or one that takes its place) needs special consideration, e.g. by checking a disk label and flushing cached blocks that were associated with the device that now is definitely gone. I had this idea back when floppy disks were common, but with USB memory sticks and devices the same situation exists ... The mode change to R/O could be triggered by a timer after the necessary condition exists (e.g. half a second after the last write to the device with no dirty buffers left). The system already knows whether there are dirty buffers for a partition, it is not hard to detect this case. The other parameter of interest is whether there are any open files on that partition (which decides whether the super-block can be marked as clean). This functionality could be implemented within an autofs as a special case (mount only R/O and upgrade only when needed and for as long as necessary), but I think it should be not too hard to add as a small in-kernel modification ... Regards, STefan _______________________________________________ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[EMAIL PROTECTED]"