Re: Some part of bug from 2.3.4 still in 2.3.5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 25 May 2006 09:00:36 -0400, "Ken Murchison" <murch@xxxxxxxxxxxxxx> said:
> Robert Mueller wrote:
> > Hi Ken
> > 
> > There's still a serious bug in 2.3.5 that causes copied messages to be 
> > pseudo invisible in the moved to folder. I can reproduce it as follows:
> 
> Have you uncovered any other bugs that need to be fixed before I 
> embarrass myself again by making a premature 2.3.6 release?

*cough*  (line numbers may vary, I'm working on a patched source set
here).

Symptom: reconstruct of a newly copied user fails with:
...
May 26 00:15:17 imap5 reconstruct[12807]: IOERROR: locking cache for user.foobarbaz: Bad file descriptor
May 26 00:15:17 imap5 reconstruct[12807]: IOERROR: locking cache for user.foobarbaz.Drafts: Bad file descriptor
May 26 00:15:17 imap5 reconstruct[12807]: IOERROR: locking cache for user.foobarbaz.Trash: Bad file descriptor
...

So, it appears that in mailbox_open_index:

mailbox.c:628      if (mailbox_doing_reconstruct) break;

means we don't run:

mailbox.c:636      mailbox->cache_fd = open(fname->buf, O_RDWR, 0);

But in mailbox_upgrade_index:

mailbox.c:1696     r = mailbox_lock_pop(mailbox);

We go ahead and try to lock pop.  Unfortunately, lock_pop actually
locks (you guessed it) cache_fd.

The attached patch protects mailbox_lock_pop and mailbox_unlock_pop
so that they turn into a noop when mailbox_doing_reconstruct is set.
Of the various approaches, this seemed the sanest to me - since they
can't possibly work without a cache_fd and you'll never have one
when in reconstruct mode.  I don't know enough about reconstruct to
go the alternative route (actually creating a cache_fd back up in
mailbox_open_index)

This is fine for us, because we generally lock users from logging in
when we're running reconstructs on them anyway.

Bron.
-- 
  Bron Gondwana
  brong@xxxxxxxxxxx

diff -ur --new-file cyrus-imapd-2.3.6.orig/imap/mailbox.c cyrus-imapd-2.3.6/imap/mailbox.c
--- cyrus-imapd-2.3.6.orig/imap/mailbox.c	2006-05-23 09:09:37.000000000 -0400
+++ cyrus-imapd-2.3.6/imap/mailbox.c	2006-05-26 01:27:42.000000000 -0400
@@ -1121,6 +1121,10 @@
 {
     int r = -1;
 
+    /* we don't have a cache_fd in reconstruct mode, so we can't lock
+     * pop */
+    if (mailbox_doing_reconstruct) return 0;
+
     if (mailbox->pop_lock_count++) return 0;
 
     r = lock_nonblocking(mailbox->cache_fd);
@@ -1173,6 +1177,10 @@
 mailbox_unlock_pop(mailbox)
 struct mailbox *mailbox;
 {
+    /* we don't have a cache_fd in reconstruct mode, so we can't lock
+     * pop */
+    if (mailbox_doing_reconstruct) return;
+
     assert(mailbox->pop_lock_count != 0);
 
     if (--mailbox->pop_lock_count == 0) {
----
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux