[Dovecot] Avoiding Hardlinks (was: Something other than dotlock for uidlist locking?)
James Berry
james at jberry.us
Thu Aug 10 02:03:03 EEST 2006
Timo,
Thanks for your comments and attention. I'm attaching a patch which
is a bit rough, but it's what I'm going to begin testing with.
Basically in all cases ifdef'd based on AVOID_HARDLINKS. Hopefully
you might be able to improve the configurability of the dotlock case.
Thanks for such a great product.
James
On Aug 9, 2006, at 3:05 PM, Timo Sirainen wrote:
> On 9.8.2006, at 23.44, James Berry wrote:
>> Timo, would you mind commenting on these to make sure my
>> understanding is correct? And for the last one, I need a
>> suggestion on how to proceed.
>>
>> file-copy.c: [EASY]
>>
>> Looks like it would be easy to take the already coded case for
>> when try_hardlink is false.
>
> Yes, easy. This case could even be #ifdefed. Although currently the
> only user of file_copy() is copying ssl-parameters.dat from /var/
> lib/dovecot to /var/run/dovecot, and I don't see it being used
> elsewhere anytime soon.
#ifdef'd
>> file-dotlock.c: [EASY]
>>
>> In dotlock_create, use try_create_lock_excl rather than
>> try_create_lock_hardlink.
>
> This really should rather be configurable from dovecot.conf, but
> there's no simple way to do that, except something like a getenv()
> hack inside the file-dotlock.c code..
>
> I don't think this should be #ifdefed since O_EXCL could break if
> you're using NFS.
#ifdef'd to always take the O_EXCL case if AVOID_HARDLINKS is defined.
>> maildir-copy.c: [LOOKS EASY]
>>
>> In maildir_copy(), take the fallback case using mail_storage_copy.
>
> This is the default (maildir_copy_with_hardlinks=no) so no need to
> do anything.
Okay, nothing done.
>> maildir-save.c: [NEED HELP]
>>
>> In maildir_file_move(), there seems to be no fallback case, and
>> I'm unsure of the desired symantics, so I could use some
>> suggestions here: can we just fall back into something like the
>> code in file-copy.c?
>
> Like you noticed, this can be changed to just rename(). The only
> reason it's link()+unlink() is because maildir spec says it should
> be done like that. And in case the maildir filenames aren't really
> unique the link()+unlink() method makes sure that mails aren't
> overwritten, but that practically can't happen with Dovecot. This
> code could perhaps also be #ifdefed..
#ifdef'd to always use rename() if AVOID_HARDLINKS is defined.
Patch attached:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-avoid-hardlinks.diff
Type: application/octet-stream
Size: 2424 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20060809/5852e426/attachment-0001.obj
More information about the dovecot
mailing list