The branch, master has been updated via 21f72a1 s3: Use talloc_tos() in notify_send() via f69c692 s3: Fix lock ordering in notify_add via a1fd41d s3: properly free the notify_onelevel record via 21375a6 s3: Replace some callers of cluster_id_equal via 81ec0cc s3: Remove the separate server_id arg to notify_init from 157a691 s3: Fix blank line endings
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 21f72a1ac3055be4128e96e7e0c457895b61a6a0 Author: Volker Lendecke <v...@samba.org> Date: Wed Mar 14 11:30:28 2012 +0100 s3: Use talloc_tos() in notify_send() Signed-off-by: Stefan Metzmacher <me...@samba.org> Autobuild-User: Stefan Metzmacher <me...@samba.org> Autobuild-Date: Thu Mar 15 12:43:41 CET 2012 on sn-devel-104 commit f69c6920d400acc3a31b778ab6cdb6b7da67adef Author: Volker Lendecke <v...@samba.org> Date: Wed Mar 14 10:52:03 2012 +0100 s3: Fix lock ordering in notify_add It's not necessary to keep the global notify record locked during the inotify and notify_onelevel.tdb operations. Signed-off-by: Stefan Metzmacher <me...@samba.org> commit a1fd41d83407eb449f8e80e309910b402272bc2e Author: Volker Lendecke <v...@samba.org> Date: Wed Mar 14 13:19:22 2012 +0100 s3: properly free the notify_onelevel record Signed-off-by: Stefan Metzmacher <me...@samba.org> commit 21375a6e5850b22687957db0d620aa84a956b287 Author: Volker Lendecke <v...@samba.org> Date: Wed Mar 14 10:33:53 2012 +0100 s3: Replace some callers of cluster_id_equal Signed-off-by: Stefan Metzmacher <me...@samba.org> commit 81ec0cc602141553045b39f54b23c40f4f668d4c Author: Volker Lendecke <v...@samba.org> Date: Wed Mar 14 10:31:13 2012 +0100 s3: Remove the separate server_id arg to notify_init The server_id is tied to the messaging_context Signed-off-by: Stefan Metzmacher <me...@samba.org> ----------------------------------------------------------------------- Summary of changes: source3/smbd/notify_internal.c | 49 ++++++++++++++++++--------------------- source3/smbd/proto.h | 2 +- source3/smbd/service.c | 1 - 3 files changed, 24 insertions(+), 28 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c index b01b10d..d442367 100644 --- a/source3/smbd/notify_internal.c +++ b/source3/smbd/notify_internal.c @@ -84,7 +84,7 @@ static int notify_destructor(struct notify_context *notify) talloc_free(). We need the messaging_ctx to allow for notifications via internal messages */ -struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, +struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct messaging_context *messaging_ctx, struct event_context *ev, connection_struct *conn) @@ -118,7 +118,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, return NULL; } - notify->server = server; + notify->server = messaging_server_id(messaging_ctx); notify->messaging_ctx = messaging_ctx; notify->list = NULL; notify->array = NULL; @@ -431,7 +431,7 @@ static void notify_add_onelevel(struct notify_context *notify, return; } - rec = dbwrap_fetch_locked(notify->db_onelevel, talloc_tos(), + rec = dbwrap_fetch_locked(notify->db_onelevel, array, make_tdb_data((uint8_t *)&e->dir_id, sizeof(e->dir_id))); if (rec == NULL) { @@ -515,22 +515,12 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0, struct notify_list *listel; size_t len; int depth; - struct db_record *rec; /* see if change notify is enabled at all */ if (notify == NULL) { return NT_STATUS_NOT_IMPLEMENTED; } - status = notify_fetch_locked(notify, &rec); - NT_STATUS_NOT_OK_RETURN(status); - - status = notify_load(notify, rec); - if (!NT_STATUS_IS_OK(status)) { - talloc_free(rec); - return status; - } - /* cope with /. on the end of the path */ len = strlen(e.path); if (len > 1 && e.path[len-1] == '.' && e.path[len-2] == '/') { @@ -579,11 +569,23 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0, then we need to install it in the array used for the intra-samba notify handling */ if (e.filter != 0 || e.subdir_filter != 0) { - status = notify_add_array(notify, rec, &e, private_data, depth); - } + struct db_record *rec; + status = notify_fetch_locked(notify, &rec); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + status = notify_load(notify, rec); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(rec); + goto done; + } + status = notify_add_array(notify, rec, &e, private_data, + depth); + TALLOC_FREE(rec); + } + status = NT_STATUS_OK; done: - talloc_free(rec); talloc_free(tmp_path); return status; @@ -642,8 +644,7 @@ NTSTATUS notify_remove_onelevel(struct notify_context *notify, for (i=0; i<array->num_entries; i++) { if ((private_data == array->entries[i].private_data) && - cluster_id_equal(¬ify->server, - &array->entries[i].server)) { + procid_equal(¬ify->server, &array->entries[i].server)) { break; } } @@ -738,7 +739,7 @@ NTSTATUS notify_remove(struct notify_context *notify, void *private_data) for (i=0;i<d->num_entries;i++) { if (private_data == d->entries[i].private_data && - cluster_id_equal(¬ify->server, &d->entries[i].server)) { + procid_equal(¬ify->server, &d->entries[i].server)) { break; } } @@ -784,7 +785,7 @@ static NTSTATUS notify_remove_all(struct notify_context *notify, for (depth=0;depth<notify->array->num_depths;depth++) { struct notify_depth *d = ¬ify->array->depth[depth]; for (i=0;i<d->num_entries;i++) { - if (cluster_id_equal(server, &d->entries[i].server)) { + if (procid_equal(server, &d->entries[i].server)) { if (i < d->num_entries-1) { memmove(&d->entries[i], &d->entries[i+1], sizeof(d->entries[i])*(d->num_entries-(i+1))); @@ -816,24 +817,20 @@ static NTSTATUS notify_send(struct notify_context *notify, struct notify_entry * DATA_BLOB data; NTSTATUS status; enum ndr_err_code ndr_err; - TALLOC_CTX *tmp_ctx; ev.action = action; ev.path = path; ev.private_data = e->private_data; - tmp_ctx = talloc_new(notify); - - ndr_err = ndr_push_struct_blob(&data, tmp_ctx, &ev, + ndr_err = ndr_push_struct_blob(&data, talloc_tos(), &ev, (ndr_push_flags_fn_t)ndr_push_notify_event); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - talloc_free(tmp_ctx); return ndr_map_error2ntstatus(ndr_err); } status = messaging_send(notify->messaging_ctx, e->server, MSG_PVFS_NOTIFY, &data); - talloc_free(tmp_ctx); + TALLOC_FREE(data.data); return status; } diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index f9eabce..0fbf9a0 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -541,7 +541,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx, /* The following definitions come from smbd/notify_internal.c */ -struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, +struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct messaging_context *messaging_ctx, struct event_context *ev, connection_struct *conn); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 3b14634..a78fa29 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -699,7 +699,6 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn, if ((!conn->printer) && (!conn->ipc)) { conn->notify_ctx = notify_init(conn, - messaging_server_id(sconn->msg_ctx), sconn->msg_ctx, sconn->ev_ctx, conn); -- Samba Shared Repository