dovecot-2.1: lib-storage: Track storage's all mailboxes to make ...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Nov 23 19:19:28 EET 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/deaebb4dc98c
changeset: 13754:deaebb4dc98c
user: Timo Sirainen <tss at iki.fi>
date: Wed Nov 23 19:19:19 2011 +0200
description:
lib-storage: Track storage's all mailboxes to make it easier to debug if one isn't closed.
diffstat:
src/lib-storage/mail-storage-private.h | 4 ++++
src/lib-storage/mail-storage.c | 7 +++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diffs (52 lines):
diff -r 4f1d20b57c04 -r deaebb4dc98c src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h Wed Nov 23 19:11:13 2011 +0200
+++ b/src/lib-storage/mail-storage-private.h Wed Nov 23 19:19:19 2011 +0200
@@ -78,6 +78,8 @@
/* counting number of objects (e.g. mailbox) that have a pointer
to this storage. */
int obj_refcount;
+ /* Linked list of all mailboxes in the storage */
+ struct mailbox *mailboxes;
const char *unique_root_dir;
char *error_string;
@@ -210,6 +212,8 @@
struct mailbox_vfuncs v, *vlast;
/* private: */
pool_t pool;
+ /* Linked list of all mailboxes in this storage */
+ struct mailbox *prev, *next;
/* these won't be set until mailbox is opened: */
struct mail_index *index;
diff -r 4f1d20b57c04 -r deaebb4dc98c src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c Wed Nov 23 19:11:13 2011 +0200
+++ b/src/lib-storage/mail-storage.c Wed Nov 23 19:19:19 2011 +0200
@@ -412,6 +412,10 @@
return;
}
+ if (storage->mailboxes != NULL) {
+ i_panic("Trying to deinit storage without freeing mailbox %s",
+ storage->mailboxes->vname);
+ }
if (storage->obj_refcount != 0)
i_panic("Trying to deinit storage before freeing its objects");
@@ -627,6 +631,7 @@
hook_mailbox_allocated(box);
} T_END;
+ DLLIST_PREPEND(&box->storage->mailboxes, box);
mail_storage_obj_ref(box->storage);
return box;
}
@@ -893,6 +898,8 @@
mailbox_close(box);
box->v.free(box);
+
+ DLLIST_REMOVE(&box->storage->mailboxes, box);
mail_storage_obj_unref(box->storage);
pool_unref(&box->pool);
}
More information about the dovecot-cvs
mailing list