• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: fsync while appending to a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fsync while appending to a file


  • Subject: Re: fsync while appending to a file
  • From: Terry Lambert <email@hidden>
  • Date: Mon, 25 Oct 2010 12:58:18 -0700

On Oct 25, 2010, at 10:53 AM, Joel Reymont wrote:
> Will fsync stall appending to a file, assuming both operations run concurrently and use different fds that point to the same file?
>
> 	Thanks, Joel

It depends on the file system.  For non-multithreaded filesystems, which are deprecated and unavailable on 64 bit kernels, yes.

Otherwise, it's implementation defined on a per-file system basis.  For HFS, also yes, since hfs_vnop_fsync() takes an hfs_lock() exclusive on the cnode while performing the operation.  For UFS, the answer would have been no.  I don't have an exact survey of answers for all the file systems supported by Mac OS X.

That doesn't mean that if you are naturally racing that the append won't get in first, so if you need to ensure order of operation, for example, to ensure a database record gets written before a database index entry gets written as part of the standard two stage commit process, you should do locking anyway, rather than relying on implementation details of a particular FS.

-- Terry _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: fsync while appending to a file
      • From: Joel Reymont <email@hidden>
References: 
 >fsync while appending to a file (From: Joel Reymont <email@hidden>)

  • Prev by Date: fsync while appending to a file
  • Next by Date: Re: fsync while appending to a file
  • Previous by thread: fsync while appending to a file
  • Next by thread: Re: fsync while appending to a file
  • Index(es):
    • Date
    • Thread