[Printing-architecture] printers.conf frequently gets truncated to zero length after unclean shutdowns
till.kamppeter at gmail.com
Mon Jul 22 17:46:37 UTC 2013
On 07/22/2013 07:28 PM, Jiri Popelka wrote:
> When cupsd lives on a filesystem with delayed allocation, like ext4 and
> it experience an unclean shutdown under heavy load, its printers.conf
> very often ends up being truncated to zero.
I have seen some Ubuntu bug reports showing this, too, but never had an
idea how this can happen. Jiri, thank you for finding this out.
Principally, this should be a bug of ext4, as the idea of a journaling
file system is to avoid data loss on an unexpected shutdown.
Fixes in CUPS are more workarounds for the shortcomings/bugs of ext4.
> Even original report (https://bugzilla.redhat.com/show_bug.cgi?id=984883)
> has been against cups-1.4.2 I've seen no reason to think this has been
> fixed in recent versions.
> I see cupsd since 1.5 (due to STR #3715) has been more carefully
> creating and removing conf files,
> but that doesn't seem to be sufficient.
> Especially updating of printers.conf probably needs some sort of
> synchronization data to disk.
> I have a patch (in comment #11), which makes cupsd read backup
> filename.O file if filename is truncated to zero, but that's only a
> and I'm afraid it won't work if the file gets updated couple times
> between last sync and the unexpected shutdown.
As CUPS is modifying printers.conf rather frequently, it is perhaps
worth to have always two copies of the most recent printers.conf and to
let CUPS modifying them one after the other to not lose the full file
but never more than the last modification.
More information about the Printing-architecture