[pacman-dev] [PATCH] libalpm: sync changes to disc when appropriate

Dan McGee dpmcgee at gmail.com
Sat Mar 14 09:32:27 EDT 2009

On Sat, Mar 14, 2009 at 8:02 AM, Xavier <shiningxc at gmail.com> wrote:
> On Sat, Mar 14, 2009 at 1:40 PM, Thomas Bächler <thomas at archlinux.org> wrote:
>> Dan McGee schrieb:
>>> We don't make calls to fsync() or fdatasync() when we are attempting to do
>>> something transactionally, such as writing out one of our DB entries. Add
>>> a
>>> call to fdatasync() when we write DB entries, and also ensure we sync our
>>> log changes to disc whenever we close it.
>>> Another important thing to ensure is that we commit removals of DB
>>> entries.
>>> The method isn't necessarily pretty, but it works in _alpm_db_remove().
>> Can we get this in the maint branch as well? I had this several times
>> yesterday when experimenting with 2.6.29-rc8 and some experimental intel
>> driver stuff and it crashed a lot. I eventually had to disable delalloc on
>> my / to make this go away.
> >From http://thunk.org/tytso/blog/2009/03/12/delayed-allocation-and-the-zero-length-file-problem/
> :
> """
> What’s the best path forward?   For now, what I would recommend to
> Ubuntu gamers whose systems crash all the time and who want to use
> ext4, to use the nodelalloc mount option.   I haven’t quantified what
> the performance penalty will be for this mode of operation, but the
> performance will be better than ext3, and at least this way they won’t
> have to worry about files getting lost as a result of delayed
> allocation.    Long term, application writers who are worried about
> files getting lost on an unclena shutdown really should use fsync.
> """"
> Short term : use nodelalloc if your system is likely to crash (using
> experimental or unstable drivers)
> Long term : fix the apps
> I don't think that improving pacman on this side ASAP will solve the
> general problem. You will still have many other apps affected on your
> system, some of them also dealing with important files. Or not?
> Anyway, I am not opposed to a new quick maint release, this decision
> is up to Dan anyway. I am just saying I don't see a big need for it.
> And in any cases, we should try to move forward for a 3.3 release :)

I never said quick with this stuff at all. Does your system crash all
the time? Or ever? Mine sure doesn't- I'm in little rush to get this

Thomas points to one case where his system does, but in that case he
is going to have a lot of broken stuff as he says as other apps also
do it wrong as well. My main point here is just to do it right- I'm
not trying to address a specific problem, just the general concern
that is "if I write a file and my app exits, can I be sure it actually
got written?".

Thomas- I believe you are right, we should sync the db directory when
we write to it as well.


More information about the pacman-dev mailing list