[Dovecot] link() problem with dovecot-imapd
I'm having a few problems with dovecot-imapd (installed from debian
unstable) and am after some much needed help, all is set up and configured, except for this final problem of when I try and move or copy a message from one Maildir to another. I have the option "maildir_copy_with_hardlinks = no" in the the dovecot.conf file but it still seems to be trying to link() the file instead of doing a proper copy. There is a log fragment below for when I try to do a move, the FS that my Maildir is on doesn't support link() hence the problem. It seems to be doing a proper copy to get it into the tmp/ part of the Maildir and then a link() to put it in new/. Any ideas on how to cure this?
Log output;l -- Sep 2 18:44:29 indulgence imap(jamesr): link(/home/jamesr/Mail/Maildir/.INBOX.Trash/tmp/1094147066.P2339Q0M915274.indulgence, /home/jamesr/Mail/Maildir/.INBOX.Trash/new/1094147066.P2339Q0M915274.indulgence:2,Sa) failed: Operation not permitted
James 'BR' Ray - EMail : jamesr@pethippo.co.uk (Primary) - EMail : j.ray@herts.ac.uk (University) - Web : http://www.pethippo.co.uk/ - PGP : http://www.pethippo.co.uk/in.php/pgp
On 2.9.2004, at 21:04, James Ray wrote:
There is a log fragment below for when I try to do a move, the FS that my Maildir is on doesn't support link() hence the problem. It seems to be doing a proper copy to get it into the tmp/ part of the Maildir and then a link() to put it in new/.
Maildir standard says to use link(), but I suppose it could fallback to rename() too.. Hmm. I'm just not sure if it's worth it to implement, it's useless bloat for most people.
And it's not just copying, it's saving messages in general which fails with you.
On Thu, 2004-09-02 at 15:06, Timo Sirainen wrote:
Maildir standard says to use link(), but I suppose it could fallback to rename() too.. Hmm. I'm just not sure if it's worth it to implement, it's useless bloat for most people.
No it doesn't. It used to- the documentation supplied with qmail (and the implementation that is qmail) use link()+unlink(), but the current maildir specification (http://cr.yp.to/proto/maildir.html) simply refers to "moving" the message without any regard to how that may be performed.
If the identifiers generated are guaranteed unique, then there isn't any need to use link()+unlink(); you should be able to save a syscall by just using rename().
Note, some silly unixes have made it difficult to get really unique file names, which is probably why DJB used/promoted link()+unlink() himself, and then later extended the delivery-identifier-format.
That said, maildir-implementations have to be NFS-aware, and that means that rename() [because it clobbers] might return successful even though it wasn't. I don't know of any NFS-implementations that do this, I'm certain at least one networked-filesystem and/or implementation does this, or could think it's a bright idea in the future...
Nevertheless, the desired effect is possible without changing dovecot: If one is using a filesystem that lacks link() but actually has a reliable rename() AND YOU TRUST DOVECOT's ABILITY TO GENERATE UNIQUE IDENTIFIERS, you could use a small LD_PRELOAD/wrapper to replace link() with rename() and disable "use hardlinks for copy" in dovecot...
-- Geo Carncross geocar@internetconnection.net Internet Connection Reliable Web Hosting http://www.internetconnection.net/
Timo Sirainen wrote:
On 2.9.2004, at 21:04, James Ray wrote:
There is a log fragment below for when I try to do a move, the FS
that my Maildir is on doesn't support link() hence the problem. It seems to be doing a proper copy to get it into the tmp/ part of the Maildir and then a link() to put it in new/.
Maildir standard says to use link(), but I suppose it could fallback to rename() too.. Hmm. I'm just not sure if it's worth it to implement, it's useless bloat for most people.
And it's not just copying, it's saving messages in general which fails with you.
any chance of someone either a) knocking me up a quick patch for this b) pointing me in the general direction of where I should be looking to write such a patch.
Thanks in advance.
-- James 'BR' Ray - EMail : jamesr@pethippo.co.uk (Primary) - EMail : j.ray@herts.ac.uk (University) - Web : http://www.pethippo.co.uk/ - PGP : http://www.pethippo.co.uk/in.php/pgp
On 4.9.2004, at 03:38, James Ray wrote:
Maildir standard says to use link(), but I suppose it could fallback to rename() too.. Hmm. I'm just not sure if it's worth it to implement, it's useless bloat for most people. And it's not just copying, it's saving messages in general which fails with you.
any chance of someone either a) knocking me up a quick patch for this b) pointing me in the general direction of where I should be looking to write such a patch.
src/lib-storage/index/maildir/maildir-save.c. Just replace the two link() calls to rename(). The unlink() call after them can also be removed.
participants (3)
-
Geo Carncross
-
James Ray
-
Timo Sirainen