[Printing-architecture] printers.conf frequently gets truncated to zero length after unclean shutdowns

Michael Sweet msweet at apple.com
Tue Jul 23 17:51:18 UTC 2013


On 2013-07-23, at 11:59 AM, Eric Sandeen <sandeen at redhat.com> wrote:
> ...
> Well, given the choice between safe and fast, IMHO safe is usually
> the best choice.  I can't imagine that an fsync of a few-K file
> every 30s is going to hurt that much.
> Is this based on a suspicion or have you actually seen problems?

In OS X 10.7/10.8 we had millions of users affected by a previously undetected fsync issue.  In the final analysis we found that the reason for the sudden reports was that fsync takes longer on systems with SSDs due to the larger buffering that typically occurs to minimize the number of write cycles used overall.

> ...
> p.s. this patch should almost DTRT, although it should sync
> the dir containing the file as well, after the .N / .O filename juggling.

You probably also want to call cupsFileFlush(fp) to ensure that the remaining data has been written.

I will consider adding a cupsd.conf directive to force an fsync call (default off) in the 1.7.0 release.  Filed as the following Apple bug:

    <rdar://problem/14523043> cups.org: Add SyncOnClose directive to fsync calls prior to closing .conf file updates.

Michael Sweet, Senior Printing System Engineer, PWG Chair

More information about the Printing-architecture mailing list