svn commit: samba r17137 - in branches/tmp/vl-messaging/source:
include lib locking printing smbd
jmcd at samba.org
jmcd at samba.org
Wed Jul 19 15:59:53 GMT 2006
Author: jmcd
Date: 2006-07-19 15:59:52 +0000 (Wed, 19 Jul 2006)
New Revision: 17137
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17137
Log:
reinitialize messaging code after a fork. from Alexksey Fedoseev.
Modified:
branches/tmp/vl-messaging/source/include/dbwrap.h
branches/tmp/vl-messaging/source/include/messages.h
branches/tmp/vl-messaging/source/lib/dbwrap_file.c
branches/tmp/vl-messaging/source/lib/dbwrap_msg.c
branches/tmp/vl-messaging/source/lib/dbwrap_tdb.c
branches/tmp/vl-messaging/source/locking/brlock.c
branches/tmp/vl-messaging/source/locking/locking.c
branches/tmp/vl-messaging/source/printing/printing.c
branches/tmp/vl-messaging/source/smbd/server.c
Changeset:
Modified: branches/tmp/vl-messaging/source/include/dbwrap.h
===================================================================
--- branches/tmp/vl-messaging/source/include/dbwrap.h 2006-07-19 15:05:06 UTC (rev 17136)
+++ branches/tmp/vl-messaging/source/include/dbwrap.h 2006-07-19 15:59:52 UTC (rev 17137)
@@ -36,6 +36,7 @@
int (*f)(TDB_DATA key, TDB_DATA data,
void *private_data),
void *private_data);
+ BOOL (*reinit)(struct db_context *db);
void *private_data;
};
Modified: branches/tmp/vl-messaging/source/include/messages.h
===================================================================
--- branches/tmp/vl-messaging/source/include/messages.h 2006-07-19 15:05:06 UTC (rev 17136)
+++ branches/tmp/vl-messaging/source/include/messages.h 2006-07-19 15:59:52 UTC (rev 17137)
@@ -87,6 +87,7 @@
#define MSG_DB_UNLOCK 5004
#define MSG_DB_STORE 5005
#define MSG_DB_DELETE 5006
+#define MSG_DB_REINIT 5007
/* Flags to classify messages - used in message_send_all() */
/* Sender will filter by flag. */
Modified: branches/tmp/vl-messaging/source/lib/dbwrap_file.c
===================================================================
--- branches/tmp/vl-messaging/source/lib/dbwrap_file.c 2006-07-19 15:05:06 UTC (rev 17136)
+++ branches/tmp/vl-messaging/source/lib/dbwrap_file.c 2006-07-19 15:59:52 UTC (rev 17137)
@@ -352,6 +352,12 @@
return count;
}
+static BOOL db_file_reinit(struct db_context *db)
+{
+ /* Don't need any reinitialization */
+ return True;
+}
+
struct db_context *db_open_file(TALLOC_CTX *mem_ctx, const char *name,
int hash_size, int tdb_flags,
int open_flags, mode_t mode)
@@ -373,6 +379,7 @@
result->private_data = ctx;
result->fetch_locked = db_file_fetch_locked;
result->traverse = db_file_traverse;
+ result->reinit = db_file_reinit;
ctx->locked_record = NULL;
if (!(ctx->dirname = talloc_strdup(ctx, name))) {
Modified: branches/tmp/vl-messaging/source/lib/dbwrap_msg.c
===================================================================
--- branches/tmp/vl-messaging/source/lib/dbwrap_msg.c 2006-07-19 15:05:06 UTC (rev 17136)
+++ branches/tmp/vl-messaging/source/lib/dbwrap_msg.c 2006-07-19 15:59:52 UTC (rev 17137)
@@ -392,6 +392,26 @@
return -1;
}
+static BOOL db_msg_reinit(struct db_context *db)
+{
+ struct db_msg_ctx *ctx = talloc_get_type_abort(db->private_data,
+ struct db_msg_ctx);
+
+ TDB_DATA null_data;
+ TDB_DATA buf;
+
+ null_data.dsize = 0;
+ null_data.dptr = NULL;
+ buf = msg_pack_data(ctx, ctx->db_index, null_data);
+
+ if(buf.dptr != NULL) {
+ message_send_pid(ctx->lockd, MSG_DB_REINIT,
+ buf.dptr, buf.dsize, False);
+ }
+
+ return True;
+}
+
static int db_msg_ctx_destr(void *p)
{
struct db_msg_ctx *ctx = talloc_get_type_abort(p, struct db_msg_ctx);
@@ -545,6 +565,7 @@
talloc_set_destructor(db_msg, db_msg_ctx_destr);
result->fetch_locked = db_msg_fetch_locked;
result->traverse = db_msg_traverse;
+ result->reinit = db_msg_reinit;
return result;
Modified: branches/tmp/vl-messaging/source/lib/dbwrap_tdb.c
===================================================================
--- branches/tmp/vl-messaging/source/lib/dbwrap_tdb.c 2006-07-19 15:05:06 UTC (rev 17136)
+++ branches/tmp/vl-messaging/source/lib/dbwrap_tdb.c 2006-07-19 15:59:52 UTC (rev 17137)
@@ -154,6 +154,12 @@
return tdb_traverse(db_ctx->tdb, db_tdb_traverse_func, &ctx);
}
+static BOOL db_tdb_reinit(struct db_context *db)
+{
+ /* We don't need a reinitialization due to tdb_reopen_all */
+ return True;
+}
+
static int db_tdb_ctx_destr(void *p)
{
struct db_tdb_ctx *ctx =
@@ -196,6 +202,7 @@
talloc_set_destructor(db_tdb, db_tdb_ctx_destr);
result->fetch_locked = db_tdb_fetch_locked;
result->traverse = db_tdb_traverse;
+ result->reinit = db_tdb_reinit;
return result;
fail:
Modified: branches/tmp/vl-messaging/source/locking/brlock.c
===================================================================
--- branches/tmp/vl-messaging/source/locking/brlock.c 2006-07-19 15:05:06 UTC (rev 17136)
+++ branches/tmp/vl-messaging/source/locking/brlock.c 2006-07-19 15:59:52 UTC (rev 17137)
@@ -263,6 +263,16 @@
}
/****************************************************************************
+ Reinitialize the brlock.tdb database.
+****************************************************************************/
+
+BOOL brl_reinit(void)
+{
+ if(!brlock_db) return False;
+ return brlock_db->reinit(brlock_db);
+}
+
+/****************************************************************************
Close down the brlock.tdb database.
****************************************************************************/
Modified: branches/tmp/vl-messaging/source/locking/locking.c
===================================================================
--- branches/tmp/vl-messaging/source/locking/locking.c 2006-07-19 15:05:06 UTC (rev 17136)
+++ branches/tmp/vl-messaging/source/locking/locking.c 2006-07-19 15:59:52 UTC (rev 17137)
@@ -371,6 +371,19 @@
}
/*******************************************************************
+ Reinitialize the share_mode management.
+******************************************************************/
+
+BOOL locking_reinit(void)
+{
+ if(!lock_db) return False;
+
+ if(!brl_reinit()) return False;
+
+ return lock_db->reinit(lock_db);
+}
+
+/*******************************************************************
Deinitialize the share_mode management.
******************************************************************/
Modified: branches/tmp/vl-messaging/source/printing/printing.c
===================================================================
--- branches/tmp/vl-messaging/source/printing/printing.c 2006-07-19 15:05:06 UTC (rev 17136)
+++ branches/tmp/vl-messaging/source/printing/printing.c 2006-07-19 15:59:52 UTC (rev 17137)
@@ -1397,13 +1397,12 @@
claim_connection( NULL, "smbd lpq backend", 0, False,
FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINT_GENERAL);
- if (!locking_init(0)) {
+ /* We should reinitialize messaging after fork */
+ message_reinit();
+ if (!locking_reinit()) {
exit(1);
}
- /* We should reinitialize messaging after fork */
- message_reinit();
-
message_register(MSG_PRINTER_UPDATE, print_queue_receive);
DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n"));
Modified: branches/tmp/vl-messaging/source/smbd/server.c
===================================================================
--- branches/tmp/vl-messaging/source/smbd/server.c 2006-07-19 15:05:06 UTC (rev 17136)
+++ branches/tmp/vl-messaging/source/smbd/server.c 2006-07-19 15:59:52 UTC (rev 17137)
@@ -489,6 +489,8 @@
/* We should reinitialize messaging socket */
message_reinit();
+ locking_reinit();
+
return True;
}
/* The parent doesn't need this socket */
More information about the samba-cvs
mailing list