[RFC PATCH] Fix index lock breakage in mailbox_release_resources()

Thomas Jarosch thomas.jarosch at intra2net.com
Thu Aug 6 10:31:32 EDT 2015


Hi Bron,

On Sunday, 19. July 2015 10:05:12 you wrote:
> > @@ -4370,7 +4371,7 @@ static int mailbox_reconstruct_create(const char
> > *name, struct mailbox **mbptr)> 
> >      /* Attempt to open index */
> >      r = mailbox_open_index(mailbox);
> > 
> > -    if (!r) r = mailbox_read_index_header(mailbox);
> > +    if (!r) r = mailbox_lock_index(mailbox, LOCK_EXCLUSIVE);
> > 
> >      if (r) {
> >  	
> >  	printf("%s: failed to read index header\n", mailbox->name);
> >  	syslog(LOG_ERR, "failed to read index header for %s", mailbox->name);
> 
> I'm not convinced by this one - the whole point with reconstruct is that
> you're working with a potentially broken mailbox, and you want to check
> each step more simply to see if it works.  I've left this one in place.
> 
> (we do need some more tests of reconstruct on mailboxes with errors in
> them to make sure it corrects them - anyone feel like doing some
> Cassandane work? :) )

we should check again on this topic. Right now the code path
in reconstruct is still broken.

I think I tested the "reconstruct" code path with something like this:

diff --git a/imap/mailbox.c b/imap/mailbox.c
index 3828053..6a9c5da 100644
--- a/imap/mailbox.c
+++ b/imap/mailbox.c
@@ -6154,7 +6154,9 @@ EXPORTED int mailbox_reconstruct(const char *name, int flags)
         syslog(LOG_NOTICE, "reconstructing %s", name);
     }
 
-    r = mailbox_open_iwl(name, &mailbox);
+    /* DEBUG hack only */
+    // r = mailbox_open_iwl(name, &mailbox);
+    r = 1;
     if (r) {
         if (!make_changes) return r;
         /* returns a locktype == LOCK_EXCLUSIVE mailbox */


Cheers,
Thomas



More information about the Cyrus-devel mailing list