[haiku-3rdparty-dev] Re: Shutdown file writes

  • From: "Earl Pottinger" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "earl_colby_pottinger@xxxxxxxxx" for DMARC)
  • To: "haiku-3rdparty-dev@xxxxxxxxxxxxx" <haiku-3rdparty-dev@xxxxxxxxxxxxx>
  • Date: Mon, 1 Sep 2014 18:24:16 -0700

Ouch, ouch, ouch.  I just reread your messages and realized the code to write 
the image is INSIDE the flush() function, thus a flush call by my driver or the 
OS is invoking the flush() in the middle of flushing.  I have some thinking and 
design work to do.



On Monday, September 1, 2014 5:49:46 PM, Alexander G. M. Smith 
<agmsmith@xxxxxx> wrote:
 


On 01/09/14 05:30 PM, Earl Pottinger wrote:

Still working on my driver, since drivers can not detect the shut-down 
operation of Haiku I have depended on cache-flush IOCTL command set to the 
driver by the OS just before shut-down operations start.  However, the full 
file does not appear to be written completely before the computer turns itself 
off.  I am using the following code to write the buffer to the hard drive.
[...]
>
Kind of tricky since cache flushing is triggered by the fsync. 
    Though your image file is presumably on a different device, so it
    could work, if the system is smart enough.

To see if your function actually delays shutdown (rather than
    running in parallel or timing out or something), add a sleep call in
    there for 10 seconds and see if that actually holds off the
    shutdown.  If not, you'll have to find some other way of delaying
    shutdown.

- Alex

Other related posts: