Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
courier-imapd and OCFS2
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
RandomDan
n00b
n00b


Joined: 03 Jul 2005
Posts: 10
Location: Doncaster, United Kingdom

PostPosted: Tue Jul 15, 2014 2:02 pm    Post subject: courier-imapd and OCFS2 Reply with quote

Hello all,
This is an odd problem to say the least.

Some background: Some time ago, I swapped out /home on GlusterFS to /home on primary/primary OCFS2 on DRBD setup. All seemed well at first. Everything appeared to work, everything was fast, I was a happy man.

Then recently I noticed that some emails were going missing, but couldn't spot a pattern.

What I've found is a problem which I think lies in OCFS2 or in courier-imapd. It only appears to show itself when a mail client (Thunderbird in my case, by messages filters, which is why I hadn't noticed) tries to move an email from one IMAP account to my IMAP account. What appears to happen is that the new mail message is successfully created in ~/.maildir/tmp and not moved to ~/.maildir/cur.
I couldn't find any errors logged by courier anywhere and ignored it for a while... then I noticed this:
Code:

Jul 14 13:20:08 defiant kernel: (courier-imapd,20893,1):ocfs2_link:790 ERROR: status = -2

A little bit of digging in the courier source and I found this function....
Code:

int maildir_movetmpnew(const char *tmpname, const char *newname)
{
        if (link(tmpname, newname) == 0)
        {
                unlink(tmpname);
                return 0;
        }

        if (errno != EXDEV)
                return -1;

        /* AFS? */

        return rename(tmpname, newname);
}

Which on the face of it seems to be more complicated than needs be and expects problems on AFS. So in the spirit of testing, I changed the function to be:
Code:

int maildir_movetmpnew(const char *tmpname, const char *newname)
{
        return rename(tmpname, newname);
}

Normal operation has now returned.
While I can see what's happening in that function... I don't get why it needs to be so complicated in the first place (I presume there's a good reason, but if simple rename works on AFS, why not for everything else?) and I don't see why my change would fix it. My gut feeling is there is a race condition in OCFS2 that link/unlink suffer from and that rename does not.

Can anyone should some light on this? Anyone else tried courier-imap on OCFS2?

Any thoughts very welcome. I'm planning on raising this upstream, but I'm genuinely not sure which upstream to go with!

Thanks in advance.
Dan
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum