[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Fri Oct 20 22:05:02 UTC 2017
The branch, master has been updated
via 629fc066 lib: Remove fncall.c
via 4b84d7c lib: Remove unused getaddinfo_send/recv
via 05bc26c torture: Remove GETADDRINFO test
via a15f58a smbd: Simplify cleanupdb a bit
via 37725f0 smbd: cleanupdb.c is used in smbd only
via 1249801 vfs_glusterfs: Fix exporting subdirs with shadow_copy2
from da8af83 selftest: Print link meta-data when developer debugging is used
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 629fc066860fead544e51bd6fa056c08b3343f9d
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 18 17:15:53 2017 +0200
lib: Remove fncall.c
This was meant as a nice wrapper around pthreadpool_add_job.
pthreadpool_tevent_job_send does the same thing. The
getaddrinfo_send/recv was the only example and can easily be re-added on
top of pthreadpool_tevent_job_send.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sat Oct 21 00:04:59 CEST 2017 on sn-devel-144
commit 4b84d7cb54838a790915f214e3d39b5ce4a3197b
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 18 17:13:04 2017 +0200
lib: Remove unused getaddinfo_send/recv
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 05bc26cbc96bed22e6cfc0cc98e8889c7195caab
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 18 17:11:21 2017 +0200
torture: Remove GETADDRINFO test
This was the only user of getaddrinfo_send and not run anyway
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit a15f58a628549c389112e1e873e128d119db04d8
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 18 16:56:49 2017 +0200
smbd: Simplify cleanupdb a bit
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 37725f0bf81448bc7f981a67402c8b4bebb10861
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 18 17:02:56 2017 +0200
smbd: cleanupdb.c is used in smbd only
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 1249801ec73c55449068dd72efde81ce6235ec8e
Author: Michael Adam <obnox at samba.org>
Date: Fri Oct 20 14:55:10 2017 +0200
vfs_glusterfs: Fix exporting subdirs with shadow_copy2
Since the glusterfs vfs module does not operate on a
locally mounted path, but on a "virtual" path starting
at the volume root, some assumptions of the code about
the vfs connect path fail. One example is the shadow_copy2
module which tries to detect the mount point from the
connectpath. In order to circumvent this problem, this
patch forces the "shadow:mountpoint" option to "/", which
skips the mount-point-detection code.
This patch will only have an effect if both the glusterfs
and the shadow_copy2 module are listed in vfs objects
in the right order, i.e. first shadow_copy2, and then
glusterfs.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13091
Pair-Programmed-With: Anoop C S <anoopcs at redhat.com>
Signed-off-by: Michael Adam <obnox at samba.org>
Signed-off-by: Anoop C S <anoopcs at redhat.com>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
selftest/skip | 1 -
source3/include/proto.h | 17 --
source3/include/smb.h | 1 -
source3/lib/cleanupdb.c | 35 ++---
source3/lib/fncall.c | 332 ----------------------------------------
source3/lib/util_sock.c | 82 ----------
source3/modules/vfs_glusterfs.c | 10 ++
source3/selftest/tests.py | 2 +-
source3/torture/torture.c | 54 -------
source3/wscript_build | 3 +-
10 files changed, 26 insertions(+), 511 deletions(-)
delete mode 100644 source3/lib/fncall.c
Changeset truncated at 500 lines:
diff --git a/selftest/skip b/selftest/skip
index c2c4553..dd60ab5 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -145,4 +145,3 @@ bench # don't run benchmarks in our selftest
^samba4.blackbox.ktpass # this test isn't portable ...
^samba4.rpc.unixinfo # This contains a server-side getpwuid call which hangs the server when nss_winbindd is in use
^samba.tests.dcerpc.unix # This contains a server-side getpwuid call which hangs the server when nss_winbindd is in use
-GETADDRINFO # socket wrapper doesn't support threads
diff --git a/source3/include/proto.h b/source3/include/proto.h
index b2c3a03..c86cd44 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -569,13 +569,6 @@ int create_pipe_sock(const char *socket_dir,
int create_tcpip_socket(const struct sockaddr_storage *ifss, uint16_t *port);
const char *get_mydnsfullname(void);
bool is_myname_or_ipaddr(const char *s);
-struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct fncall_context *ctx,
- const char *node,
- const char *service,
- const struct addrinfo *hints);
-int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
int poll_one_fd(int fd, int events, int timeout, int *revents);
int poll_intr_one_fd(int fd, int events, int timeout, int *revents);
@@ -1031,16 +1024,6 @@ char *get_pass( const char *prompt, bool stdin_get);
struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
struct tevent_context *ev);
-/* The following definitions come from lib/fncall.c */
-
-struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
- int max_threads);
-struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
- struct fncall_context *ctx,
- void (*fn)(void *private_data),
- void *private_data);
-int fncall_recv(struct tevent_req *req, int *perr);
-
/* The following definitions come from libsmb/smbsock_connect.c */
struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 24a73e5..0e79cb8 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -125,7 +125,6 @@ struct uuid;
struct named_mutex;
struct wb_context;
struct rpc_cli_smbd_conn;
-struct fncall_context;
/* the basic packet size, assuming no words or bytes */
#define smb_size 39
diff --git a/source3/lib/cleanupdb.c b/source3/lib/cleanupdb.c
index 7bf7c7e..3250d60 100644
--- a/source3/lib/cleanupdb.c
+++ b/source3/lib/cleanupdb.c
@@ -24,8 +24,6 @@ struct cleanup_key {
};
struct cleanup_rec {
- /* Storing the pid here as well saves a few lines of code */
- pid_t pid;
bool unclean;
};
@@ -59,7 +57,7 @@ bool cleanupdb_store_child(const pid_t pid, const bool unclean)
{
struct tdb_wrap *db;
struct cleanup_key key = { .pid = pid };
- struct cleanup_rec rec = { .pid = pid, .unclean = unclean };
+ struct cleanup_rec rec = { .unclean = unclean };
TDB_DATA tdbkey = { .dptr = (uint8_t *)&key, .dsize = sizeof(key) };
TDB_DATA tdbdata = { .dptr = (uint8_t *)&rec, .dsize = sizeof(rec) };
int result;
@@ -99,20 +97,6 @@ bool cleanupdb_delete_child(const pid_t pid)
return true;
}
-static bool cleanup_rec_parse(TDB_DATA tdbdata,
- struct cleanup_rec *cleanup_rec)
-{
- if (tdbdata.dsize != sizeof(struct cleanup_rec)) {
- DBG_ERR("Found invalid value length %d in cleanup.tdb\n",
- (int)tdbdata.dsize);
- return false;
- }
-
- memcpy(cleanup_rec, tdbdata.dptr, sizeof(struct cleanup_rec));
-
- return true;
-}
-
struct cleanup_read_state {
int (*fn)(const pid_t pid, const bool cleanup, void *private_data);
void *private_data;
@@ -124,16 +108,25 @@ static int cleanup_traverse_fn(struct tdb_context *tdb,
{
struct cleanup_read_state *state =
(struct cleanup_read_state *)private_data;
+ struct cleanup_key ckey;
struct cleanup_rec rec;
- bool ok;
int result;
- ok = cleanup_rec_parse(value, &rec);
- if (!ok) {
+ if (key.dsize != sizeof(struct cleanup_key)) {
+ DBG_ERR("Found invalid key length %zu in cleanup.tdb\n",
+ key.dsize);
+ return -1;
+ }
+ memcpy(&ckey, key.dptr, sizeof(struct cleanup_key));
+
+ if (value.dsize != sizeof(struct cleanup_rec)) {
+ DBG_ERR("Found invalid value length %zu in cleanup.tdb\n",
+ value.dsize);
return -1;
}
+ memcpy(&rec, value.dptr, sizeof(struct cleanup_rec));
- result = state->fn(rec.pid, rec.unclean, state->private_data);
+ result = state->fn(ckey.pid, rec.unclean, state->private_data);
if (result != 0) {
return -1;
}
diff --git a/source3/lib/fncall.c b/source3/lib/fncall.c
deleted file mode 100644
index 34db472..0000000
--- a/source3/lib/fncall.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * Async fn calls
- * Copyright (C) Volker Lendecke 2009
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-#include "../lib/util/tevent_unix.h"
-
-#include "../lib/pthreadpool/pthreadpool_pipe.h"
-
-struct fncall_state {
- struct fncall_context *ctx;
- int job_id;
- bool done;
-
- void *private_parent;
- void *job_private;
-};
-
-struct fncall_context {
- struct pthreadpool_pipe *pool;
- int next_job_id;
- int sig_fd;
- struct tevent_req **pending;
-
- struct fncall_state **orphaned;
- int num_orphaned;
-
- struct tevent_fd *fde;
-};
-
-static void fncall_handler(struct tevent_context *ev, struct tevent_fd *fde,
- uint16_t flags, void *private_data);
-
-static int fncall_context_destructor(struct fncall_context *ctx)
-{
- while (talloc_array_length(ctx->pending) != 0) {
- /* No TALLOC_FREE here */
- talloc_free(ctx->pending[0]);
- }
-
- while (ctx->num_orphaned != 0) {
- /*
- * We've got jobs in the queue for which the tevent_req has
- * been finished already. Wait for all of them to finish.
- */
- fncall_handler(NULL, NULL, TEVENT_FD_READ, ctx);
- }
-
- pthreadpool_pipe_destroy(ctx->pool);
- ctx->pool = NULL;
-
- return 0;
-}
-
-struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
- int max_threads)
-{
- struct fncall_context *ctx;
- int ret;
-
- ctx = talloc_zero(mem_ctx, struct fncall_context);
- if (ctx == NULL) {
- return NULL;
- }
-
- ret = pthreadpool_pipe_init(max_threads, &ctx->pool);
- if (ret != 0) {
- TALLOC_FREE(ctx);
- return NULL;
- }
- talloc_set_destructor(ctx, fncall_context_destructor);
-
- ctx->sig_fd = pthreadpool_pipe_signal_fd(ctx->pool);
- if (ctx->sig_fd == -1) {
- TALLOC_FREE(ctx);
- return NULL;
- }
-
- return ctx;
-}
-
-static int fncall_next_job_id(struct fncall_context *ctx)
-{
- int num_pending = talloc_array_length(ctx->pending);
- int result;
-
- while (true) {
- int i;
-
- result = ctx->next_job_id++;
- if (result == 0) {
- continue;
- }
-
- for (i=0; i<num_pending; i++) {
- struct fncall_state *state = tevent_req_data(
- ctx->pending[i], struct fncall_state);
-
- if (result == state->job_id) {
- break;
- }
- }
- if (i == num_pending) {
- return result;
- }
- }
-}
-
-static void fncall_unset_pending(struct tevent_req *req);
-static void fncall_cleanup(struct tevent_req *req,
- enum tevent_req_state req_state);
-
-static bool fncall_set_pending(struct tevent_req *req,
- struct fncall_context *ctx,
- struct tevent_context *ev)
-{
- struct tevent_req **pending;
- int num_pending, orphaned_array_length;
-
- num_pending = talloc_array_length(ctx->pending);
-
- pending = talloc_realloc(ctx, ctx->pending, struct tevent_req *,
- num_pending+1);
- if (pending == NULL) {
- return false;
- }
- pending[num_pending] = req;
- num_pending += 1;
- ctx->pending = pending;
- tevent_req_set_cleanup_fn(req, fncall_cleanup);
-
- /*
- * Make sure that the orphaned array of fncall_state structs has
- * enough space. A job can change from pending to orphaned in
- * fncall_cleanup, and to fail in a talloc destructor should be
- * avoided if possible.
- */
-
- orphaned_array_length = talloc_array_length(ctx->orphaned);
- if (num_pending > orphaned_array_length) {
- struct fncall_state **orphaned;
-
- orphaned = talloc_realloc(ctx, ctx->orphaned,
- struct fncall_state *,
- orphaned_array_length + 1);
- if (orphaned == NULL) {
- fncall_unset_pending(req);
- return false;
- }
- ctx->orphaned = orphaned;
- }
-
- if (ctx->fde != NULL) {
- return true;
- }
-
- ctx->fde = tevent_add_fd(ev, ctx->pending, ctx->sig_fd, TEVENT_FD_READ,
- fncall_handler, ctx);
- if (ctx->fde == NULL) {
- fncall_unset_pending(req);
- return false;
- }
- return true;
-}
-
-static void fncall_unset_pending(struct tevent_req *req)
-{
- struct fncall_state *state = tevent_req_data(req, struct fncall_state);
- struct fncall_context *ctx = state->ctx;
- int num_pending = talloc_array_length(ctx->pending);
- int i;
-
- tevent_req_set_cleanup_fn(req, NULL);
-
- if (num_pending == 1) {
- TALLOC_FREE(ctx->fde);
- TALLOC_FREE(ctx->pending);
- return;
- }
-
- for (i=0; i<num_pending; i++) {
- if (req == ctx->pending[i]) {
- break;
- }
- }
- if (i == num_pending) {
- return;
- }
- if (num_pending > 1) {
- ctx->pending[i] = ctx->pending[num_pending-1];
- }
- ctx->pending = talloc_realloc(NULL, ctx->pending, struct tevent_req *,
- num_pending - 1);
-}
-
-static void fncall_cleanup(struct tevent_req *req,
- enum tevent_req_state req_state)
-{
- struct fncall_state *state = tevent_req_data(
- req, struct fncall_state);
- struct fncall_context *ctx = state->ctx;
-
- switch (req_state) {
- case TEVENT_REQ_RECEIVED:
- break;
- default:
- return;
- }
-
- fncall_unset_pending(req);
-
- if (state->done) {
- return;
- }
-
- /*
- * Keep around the state of the deleted request until the request has
- * finished in the helper thread. fncall_handler will destroy it.
- */
- ctx->orphaned[ctx->num_orphaned] = talloc_move(ctx->orphaned, &state);
- ctx->num_orphaned += 1;
-}
-
-struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
- struct fncall_context *ctx,
- void (*fn)(void *private_data),
- void *private_data)
-{
- struct tevent_req *req;
- struct fncall_state *state;
- int ret;
-
- req = tevent_req_create(mem_ctx, &state, struct fncall_state);
- if (req == NULL) {
- return NULL;
- }
- state->ctx = ctx;
- state->job_id = fncall_next_job_id(state->ctx);
- state->done = false;
-
- /*
- * We need to keep the private data we handed out to the thread around
- * as long as the job is not finished. This is a bit of an abstraction
- * violation, because the "req->state1->subreq->state2" (we're
- * "subreq", "req" is the request our caller creates) is broken to
- * "ctx->state2->state1", but we are right now in the destructor for
- * "subreq2", so what can we do. We need to keep state1 around,
- * otherwise the helper thread will have no place to put its results.
- */
-
- state->private_parent = talloc_parent(private_data);
- state->job_private = talloc_move(state, &private_data);
-
- ret = pthreadpool_pipe_add_job(state->ctx->pool, state->job_id, fn,
- state->job_private);
- if (ret == -1) {
- tevent_req_error(req, errno);
- return tevent_req_post(req, ev);
- }
- if (!fncall_set_pending(req, state->ctx, ev)) {
- tevent_req_oom(req);
- return tevent_req_post(req, ev);
- }
- return req;
-}
-
-static void fncall_handler(struct tevent_context *ev, struct tevent_fd *fde,
- uint16_t flags, void *private_data)
-{
- struct fncall_context *ctx = talloc_get_type_abort(
- private_data, struct fncall_context);
- int i, num_pending;
- int job_id;
-
- if (pthreadpool_pipe_finished_jobs(ctx->pool, &job_id, 1) < 0) {
- return;
- }
-
- num_pending = talloc_array_length(ctx->pending);
-
- for (i=0; i<num_pending; i++) {
- struct fncall_state *state = tevent_req_data(
- ctx->pending[i], struct fncall_state);
-
- if (job_id == state->job_id) {
- state->done = true;
- talloc_move(state->private_parent,
- &state->job_private);
- tevent_req_done(ctx->pending[i]);
- return;
- }
- }
-
- for (i=0; i<ctx->num_orphaned; i++) {
- if (job_id == ctx->orphaned[i]->job_id) {
- break;
- }
- }
- if (i == ctx->num_orphaned) {
- return;
- }
-
- TALLOC_FREE(ctx->orphaned[i]);
-
- if (i < ctx->num_orphaned-1) {
- ctx->orphaned[i] = ctx->orphaned[ctx->num_orphaned-1];
- }
- ctx->num_orphaned -= 1;
-}
-
-int fncall_recv(struct tevent_req *req, int *perr)
-{
- if (tevent_req_is_unix_error(req, perr)) {
- return -1;
- }
- return 0;
-}
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 0e1a66c..c74fcd9 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1346,88 +1346,6 @@ bool is_myname_or_ipaddr(const char *s)
return false;
}
-struct getaddrinfo_state {
- const char *node;
- const char *service;
- const struct addrinfo *hints;
- struct addrinfo *res;
- int ret;
-};
-
-static void getaddrinfo_do(void *private_data);
-static void getaddrinfo_done(struct tevent_req *subreq);
-
-struct tevent_req *getaddrinfo_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct fncall_context *ctx,
- const char *node,
- const char *service,
- const struct addrinfo *hints)
-{
- struct tevent_req *req, *subreq;
- struct getaddrinfo_state *state;
-
- req = tevent_req_create(mem_ctx, &state, struct getaddrinfo_state);
- if (req == NULL) {
- return NULL;
- }
--
Samba Shared Repository
More information about the samba-cvs
mailing list