[Dovecot] link() failed / maildir_copy_with_hardlinks=no / maildir-save.c.patch

David C. Reeve David.Reeve at pnsol.com
Wed Jan 12 18:11:51 EET 2005


Hi,

I have recently been having a small problem with Dovecot
(dovecot-0.99.13) not honouring the "maildir_copy_with_hardlinks" config
option, specifically when it is set to "no".  This results in errors to
the syslog looking like:

  Jan 12 09:59:21 imap imap(dave):
link(/afs/.../tmp/1105541958.P1137Q0M41428.imap, /afs/.../new/1105541958.P1137Q0M41428.imap:2,S) failed in maildir_copy: Invalid cross-device link

The supplied patch will, when maildir_copy_with_hardlinks=no, rename
files inside maildir's instead of hard linking them, hence honouring the
configuration option.

A word of caution!  This all relies on the filenames in maildir being
unique (which they should be, and this shouldn't be a problem, but..).
It is possible (although unlikely) that renaming the file could destroy
a file in the target directory; no checking is done to assure this is
not the case!  (If you are paranoid you can always write another patch).

Yes I am using AFS (openafs specifically) to hold my maildir's, which
does not support hard links.  However AFS assures that rename operations
are atomic so we can use that instead (this may be the case for other
filling systems that do not allow hard links).

Hope that helps some one else ;)

Dave

-- 
David C. Reeve <David.Reeve at pnsol.com>
Predictable Network Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maildir-save.c.patch
Type: text/x-patch
Size: 1476 bytes
Desc: Patch to maildir-save.c
URL: <http://dovecot.org/pipermail/dovecot/attachments/20050112/0fba939e/attachment-0001.bin>


More information about the dovecot mailing list