dovecot-2.2: lib-fs: Keep a linked list of all files within fs t...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 28 15:41:48 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/2324dea38a03
changeset: 17757:2324dea38a03
user: Timo Sirainen <tss at iki.fi>
date: Fri Aug 29 00:41:07 2014 +0900
description:
lib-fs: Keep a linked list of all files within fs to help debugging.
diffstat:
src/lib-fs/fs-api-private.h | 4 ++++
src/lib-fs/fs-api.c | 8 ++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diffs (57 lines):
diff -r 0ff8d85a6893 -r 2324dea38a03 src/lib-fs/fs-api-private.h
--- a/src/lib-fs/fs-api-private.h Thu Aug 28 23:52:46 2014 +0900
+++ b/src/lib-fs/fs-api-private.h Fri Aug 29 00:41:07 2014 +0900
@@ -65,9 +65,13 @@
string_t *last_error;
unsigned int files_open_count;
+ struct fs_file *files;
};
struct fs_file {
+ /* linked list of all files (mainly for debugging leaks) */
+ struct fs_file *prev, *next;
+
struct fs *fs;
struct ostream *output;
char *path;
diff -r 0ff8d85a6893 -r 2324dea38a03 src/lib-fs/fs-api.c
--- a/src/lib-fs/fs-api.c Thu Aug 28 23:52:46 2014 +0900
+++ b/src/lib-fs/fs-api.c Fri Aug 29 00:41:07 2014 +0900
@@ -3,6 +3,7 @@
#include "lib.h"
#include "array.h"
#include "module-dir.h"
+#include "llist.h"
#include "str.h"
#include "hash-method.h"
#include "istream.h"
@@ -140,9 +141,10 @@
*_fs = NULL;
if (fs->files_open_count > 0) {
- i_panic("fs-%s: %u files still open",
- fs->name, fs->files_open_count);
+ i_panic("fs-%s: %u files still open (first = %s)",
+ fs->name, fs->files_open_count, fs_file_path(fs->files));
}
+ i_assert(fs->files == NULL);
i_free(fs->username);
i_free(fs->session_id);
@@ -174,6 +176,7 @@
} T_END;
file->flags = mode_flags & ~FS_OPEN_MODE_MASK;
fs->files_open_count++;
+ DLLIST_PREPEND(&fs->files, file);
return file;
}
@@ -188,6 +191,7 @@
fs_file_close(file);
+ DLLIST_REMOVE(&file->fs->files, file);
file->fs->files_open_count--;
T_BEGIN {
file->fs->v.file_deinit(file);
More information about the dovecot-cvs
mailing list