[haiku-gsoc] Re: Handling Device Unmounting

  • From: Rene Gollent <anevilyak@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Thu, 9 Jul 2009 10:08:39 -0500

On Thu, Jul 9, 2009 at 10:03 AM, Ankur Sethi<get.me.ankur@xxxxxxxxx> wrote:
> I suppose Haiku will raise a warning if a user tries to unmount a
> volume while a process is writing to it?

It's not quite that simple...consider things like USB hard disks. If
the user unplugs that disk, nothing the OS can do would allow you to
complete your operations before the hardware's no longer available to
write to. Ditto power failure. In general a transactional system
involves first writing a list of operations to do in a journal, and
then committing those to the actual location once the journal has been
verified as being written. If the commit to the final location is
interrupted by an unmount or power failure, the journal can be used to
'replay' those operations and ensure that all the operations occurred,
or conversely ensure that the operations can be undone such that the
index is in the state it was in prior to that batch. This is where the
transactional side of things come in - either all of it completes, or
the operation is reverted completely such that none of it ever
happened. In any case though you're generally not allowed to unmount a
volume purely in software while a process still has an open fd on it.

Regards,

Rene

Other related posts: