[lkml]   [2011]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Appropriate use of sync() from user space?
    On 10/05/2011 05:57 PM, Mark Mielke wrote:

    > The vendor stated that sync() is integral to their synchronization
    > process to ensure all files reach disk before they are accessed, and
    > that this is not a defect in their product. We have a work around - run
    > "sync" before calling their command, and this generally avoids the
    > failures.
    > I think the use of sync() in this regard is a hack. According to POSIX.1
    > and the Linux man pages, it seems clear to me that sync() does not
    > guarantee data integrity (bytes guaranteed to have reached disk) - and
    > it also seems clear that forcing all system data to flush out in
    > response to a minor command is over kill. Like cutting down the forest
    > to harvest fruit from a single tree.
    > I'm wondering what you think.

    Totally agree.

    The susv3 man page for sync() is pretty clear: "The writing, although
    scheduled, is not necessarily complete upon return from sync()."

    They should probably be using msync()/fsync()/fdatasync() which only
    affect the specified files and are supposed to wait for the data to hit
    the storage device. Of course this would require them to do something
    for each file they touch rather than once at the end of the whole operation.


    Chris Friesen
    Software Developer

     \ /
      Last update: 2011-10-06 02:33    [W:0.022 / U:29.492 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site