mirror of
https://github.com/samba-team/samba.git
synced 2025-01-25 06:04:04 +03:00
r20647: add cluster code
This commit is contained in:
parent
2365abaa99
commit
5870830b99
@ -64,7 +64,7 @@ $AUTOCONF $IPATHS || exit 1
|
|||||||
rm -rf autom4te*.cache
|
rm -rf autom4te*.cache
|
||||||
|
|
||||||
echo "$0: building Web Application Framework (SWAT)"
|
echo "$0: building Web Application Framework (SWAT)"
|
||||||
make -C ../webapps/swat distclean build || exit 1
|
#make -C ../webapps/swat distclean build || exit 1
|
||||||
|
|
||||||
echo "Now run ./configure and then make."
|
echo "Now run ./configure and then make."
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
fix -I
|
||||||
|
put in subdir does in \
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Unix SMB/CIFS implementation.
|
Unix SMB/CIFS implementation.
|
||||||
SMB client
|
SMB client
|
||||||
|
45
source/cluster/cluster.c
Normal file
45
source/cluster/cluster.c
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Unix SMB/CIFS implementation.
|
||||||
|
|
||||||
|
core clustering code
|
||||||
|
|
||||||
|
Copyright (C) Andrew Tridgell 2006
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "includes.h"
|
||||||
|
#include "cluster/cluster.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
server a server_id for the local node
|
||||||
|
*/
|
||||||
|
struct server_id cluster_id(uint32_t id)
|
||||||
|
{
|
||||||
|
struct server_id server_id;
|
||||||
|
ZERO_STRUCT(server_id);
|
||||||
|
server_id.id = id;
|
||||||
|
return server_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
return a server_id as a string
|
||||||
|
*/
|
||||||
|
const char *cluster_id_string(TALLOC_CTX *mem_ctx, struct server_id id)
|
||||||
|
{
|
||||||
|
return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id);
|
||||||
|
}
|
||||||
|
|
35
source/cluster/cluster.h
Normal file
35
source/cluster/cluster.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
Unix SMB/CIFS implementation.
|
||||||
|
|
||||||
|
structures for clustering
|
||||||
|
|
||||||
|
Copyright (C) Andrew Tridgell 2006
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CLUSTER_H__
|
||||||
|
#define __CLUSTER_H__
|
||||||
|
|
||||||
|
/*
|
||||||
|
test for same cluster id
|
||||||
|
*/
|
||||||
|
#define cluster_id_equal(id1, id2) ((id1)->id == (id2)->id && (id1)->node == (id2)->node)
|
||||||
|
|
||||||
|
/* prototypes */
|
||||||
|
struct server_id cluster_id(uint32_t id);
|
||||||
|
const char *cluster_id_string(TALLOC_CTX *mem_ctx, struct server_id id);
|
||||||
|
|
||||||
|
#endif
|
4
source/cluster/config.mk
Normal file
4
source/cluster/config.mk
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
####################
|
||||||
|
[SUBSYSTEM::CLUSTER]
|
||||||
|
OBJ_FILES = cluster.o
|
File diff suppressed because it is too large
Load Diff
@ -108,5 +108,4 @@ enum announce_as {/* Types of machine we can announce as. */
|
|||||||
ANNOUNCE_AS_NT_WORKSTATION=4
|
ANNOUNCE_AS_NT_WORKSTATION=4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* _SAMBA_CORE_H */
|
#endif /* _SAMBA_CORE_H */
|
||||||
|
@ -1028,6 +1028,39 @@ static bool test_autofree(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool test_incref(void)
|
||||||
|
{
|
||||||
|
void *top = talloc_new(NULL);
|
||||||
|
char *a = talloc_strdup(top, "/");
|
||||||
|
char *b = talloc_strdup(a,"/b");
|
||||||
|
char *c = talloc_strdup(b,"/b/a");
|
||||||
|
|
||||||
|
// Make a have some more children
|
||||||
|
talloc_strdup(a,"/c");
|
||||||
|
talloc_strdup(a,"/d");
|
||||||
|
talloc_strdup(a,"/e");
|
||||||
|
|
||||||
|
// Now b has some more other children.
|
||||||
|
talloc_strdup(b,"/b/b");
|
||||||
|
|
||||||
|
//Now we incref c presumably because we want to keep it valid:
|
||||||
|
talloc_increase_ref_count(c);
|
||||||
|
|
||||||
|
// I am freeing a here, but I expect c to still be valid because I have
|
||||||
|
// increased reference for it just above.
|
||||||
|
talloc_free(a);
|
||||||
|
|
||||||
|
talloc_report_full(NULL, stdout);
|
||||||
|
|
||||||
|
// This is where talloc aborts, valgrind indicates a double free
|
||||||
|
talloc_free(c);
|
||||||
|
|
||||||
|
CHECK_BLOCKS("top", top, 1);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct torture_context;
|
struct torture_context;
|
||||||
bool torture_local_talloc(struct torture_context *tctx)
|
bool torture_local_talloc(struct torture_context *tctx)
|
||||||
{
|
{
|
||||||
@ -1044,6 +1077,7 @@ bool torture_local_talloc(struct torture_context *tctx)
|
|||||||
ret &= test_ref4();
|
ret &= test_ref4();
|
||||||
ret &= test_unlink1();
|
ret &= test_unlink1();
|
||||||
ret &= test_misc();
|
ret &= test_misc();
|
||||||
|
ret &= test_incref();
|
||||||
ret &= test_realloc();
|
ret &= test_realloc();
|
||||||
ret &= test_realloc_child();
|
ret &= test_realloc_child();
|
||||||
ret &= test_steal();
|
ret &= test_steal();
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
NTFS filesystem internals
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Unix SMB/CIFS implementation.
|
Unix SMB/CIFS implementation.
|
||||||
SMB transaction2 handling
|
SMB transaction2 handling
|
||||||
|
@ -72,6 +72,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
|
|||||||
|
|
||||||
SSVAL(req->out.body, 0x02, io->in.oplock_flags);
|
SSVAL(req->out.body, 0x02, io->in.oplock_flags);
|
||||||
SIVAL(req->out.body, 0x04, io->in.impersonation);
|
SIVAL(req->out.body, 0x04, io->in.impersonation);
|
||||||
|
/* are these 16 bytes the root_fid (vl) */
|
||||||
SIVAL(req->out.body, 0x08, io->in.unknown3[0]);
|
SIVAL(req->out.body, 0x08, io->in.unknown3[0]);
|
||||||
SIVAL(req->out.body, 0x0C, io->in.unknown3[1]);
|
SIVAL(req->out.body, 0x0C, io->in.unknown3[1]);
|
||||||
SIVAL(req->out.body, 0x10, io->in.unknown3[2]);
|
SIVAL(req->out.body, 0x10, io->in.unknown3[2]);
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
/*
|
||||||
|
add to build farm
|
||||||
|
add masktest and locktest too
|
||||||
|
add -W flag
|
||||||
|
convert to popt_common
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Unix SMB/CIFS implementation.
|
Unix SMB/CIFS implementation.
|
||||||
generic testing tool
|
generic testing tool
|
||||||
@ -354,6 +361,7 @@ static int gen_int_range(uint_t min, uint_t max)
|
|||||||
static uint16_t gen_root_fid(int instance)
|
static uint16_t gen_root_fid(int instance)
|
||||||
{
|
{
|
||||||
if (gen_chance(5)) return gen_fnum(instance);
|
if (gen_chance(5)) return gen_fnum(instance);
|
||||||
|
if (gen_chance(2)) return BAD_HANDLE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,9 @@ static bool test_event_context(struct torture_context *torture_ctx,
|
|||||||
event_add_timed(ev_ctx, ev_ctx, timeval_current_ofs(0,500),
|
event_add_timed(ev_ctx, ev_ctx, timeval_current_ofs(0,500),
|
||||||
timed_handler, fde);
|
timed_handler, fde);
|
||||||
|
|
||||||
event_loop_wait(ev_ctx);
|
while (fde) {
|
||||||
|
event_loop_once(ev_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
close(read_fd);
|
close(read_fd);
|
||||||
close(write_fd);
|
close(write_fd);
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
/*
|
||||||
|
use popt_common code
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Unix SMB/CIFS implementation.
|
Unix SMB/CIFS implementation.
|
||||||
mask_match tester
|
mask_match tester
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "torture/util.h"
|
#include "torture/util.h"
|
||||||
#include "torture/torture.h"
|
#include "torture/torture.h"
|
||||||
#include "system/filesys.h"
|
#include "system/filesys.h"
|
||||||
|
#include "system/locale.h"
|
||||||
#include "pstring.h"
|
#include "pstring.h"
|
||||||
|
|
||||||
#include "torture/nbench/proto.h"
|
#include "torture/nbench/proto.h"
|
||||||
@ -44,7 +45,6 @@ static BOOL run_netbench(struct torture_context *tctx, struct smbcli_state *cli,
|
|||||||
pstring line;
|
pstring line;
|
||||||
char *cname;
|
char *cname;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
const char **params;
|
|
||||||
BOOL correct = True;
|
BOOL correct = True;
|
||||||
|
|
||||||
if (torture_nprocs == 1) {
|
if (torture_nprocs == 1) {
|
||||||
@ -64,9 +64,13 @@ static BOOL run_netbench(struct torture_context *tctx, struct smbcli_state *cli,
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
again:
|
again:
|
||||||
|
nbio_time_reset();
|
||||||
|
|
||||||
while (fgets(line, sizeof(line)-1, f)) {
|
while (fgets(line, sizeof(line)-1, f)) {
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
const char **params0, **params;
|
||||||
|
|
||||||
nbench_line_count++;
|
nbench_line_count++;
|
||||||
|
|
||||||
@ -74,9 +78,16 @@ again:
|
|||||||
|
|
||||||
all_string_sub(line,"client1", cname, sizeof(line));
|
all_string_sub(line,"client1", cname, sizeof(line));
|
||||||
|
|
||||||
params = str_list_make_shell(NULL, line, " ");
|
params = params0 = str_list_make_shell(NULL, line, " ");
|
||||||
i = str_list_length(params);
|
i = str_list_length(params);
|
||||||
|
|
||||||
|
if (i > 0 && isdigit(params[0][0])) {
|
||||||
|
double targett = strtod(params[0], NULL);
|
||||||
|
nbio_time_delay(targett);
|
||||||
|
params++;
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
if (i < 2 || params[0][0] == '#') continue;
|
if (i < 2 || params[0][0] == '#') continue;
|
||||||
|
|
||||||
if (!strncmp(params[0],"SMB", 3)) {
|
if (!strncmp(params[0],"SMB", 3)) {
|
||||||
@ -146,7 +157,7 @@ again:
|
|||||||
printf("[%d] Unknown operation %s\n", nbench_line_count, params[0]);
|
printf("[%d] Unknown operation %s\n", nbench_line_count, params[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
talloc_free(params);
|
talloc_free(params0);
|
||||||
|
|
||||||
if (nb_tick()) goto done;
|
if (nb_tick()) goto done;
|
||||||
}
|
}
|
||||||
|
@ -53,8 +53,25 @@ static struct {
|
|||||||
double bytes, warmup_bytes;
|
double bytes, warmup_bytes;
|
||||||
int line;
|
int line;
|
||||||
int done;
|
int done;
|
||||||
|
double max_latency;
|
||||||
|
struct timeval starttime;
|
||||||
} *children;
|
} *children;
|
||||||
|
|
||||||
|
void nbio_time_reset(void)
|
||||||
|
{
|
||||||
|
children[nbio_id].starttime = timeval_current();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nbio_time_delay(double targett)
|
||||||
|
{
|
||||||
|
double elapsed = timeval_elapsed(&children[nbio_id].starttime);
|
||||||
|
if (targett > elapsed) {
|
||||||
|
msleep(1000*(targett - elapsed));
|
||||||
|
} else if (elapsed - targett > children[nbio_id].max_latency) {
|
||||||
|
children[nbio_id].max_latency = elapsed - targett;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
double nbio_result(void)
|
double nbio_result(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -65,6 +82,19 @@ double nbio_result(void)
|
|||||||
return 1.0e-6 * total / timeval_elapsed2(&tv_start, &tv_end);
|
return 1.0e-6 * total / timeval_elapsed2(&tv_start, &tv_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double nbio_latency(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
double max_latency = 0;
|
||||||
|
for (i=0;i<nprocs;i++) {
|
||||||
|
if (children[i].max_latency > max_latency) {
|
||||||
|
max_latency = children[i].max_latency;
|
||||||
|
children[i].max_latency = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return max_latency;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL nb_tick(void)
|
BOOL nb_tick(void)
|
||||||
{
|
{
|
||||||
return children[nbio_id].done;
|
return children[nbio_id].done;
|
||||||
@ -122,9 +152,9 @@ void nb_alarm(int sig)
|
|||||||
nprocs, lines/nprocs,
|
nprocs, lines/nprocs,
|
||||||
nbio_result(), t);
|
nbio_result(), t);
|
||||||
} else {
|
} else {
|
||||||
printf("%4d %8d %.2f MB/sec execute %.0f sec \n",
|
printf("%4d %8d %.2f MB/sec execute %.0f sec latency %.2f msec \n",
|
||||||
nprocs, lines/nprocs,
|
nprocs, lines/nprocs,
|
||||||
nbio_result(), t);
|
nbio_result(), t, nbio_latency() * 1.0e3);
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@ -443,7 +473,7 @@ void nb_readx(int handle, off_t offset, int size, int ret_size, NTSTATUS status)
|
|||||||
io.readx.in.remaining = 0;
|
io.readx.in.remaining = 0;
|
||||||
io.readx.in.read_for_execute = False;
|
io.readx.in.read_for_execute = False;
|
||||||
io.readx.out.data = buf;
|
io.readx.out.data = buf;
|
||||||
|
|
||||||
ret = smb_raw_read(c->tree, &io);
|
ret = smb_raw_read(c->tree, &io);
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
@ -162,7 +162,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
|
|||||||
|
|
||||||
printf("testing parallel fetchfile with %d ops\n", torture_numops);
|
printf("testing parallel fetchfile with %d ops\n", torture_numops);
|
||||||
|
|
||||||
event_ctx = event_context_init(mem_ctx);
|
event_ctx = event_context_find(mem_ctx);
|
||||||
c = talloc_array(mem_ctx, struct composite_context *, torture_numops);
|
c = talloc_array(mem_ctx, struct composite_context *, torture_numops);
|
||||||
|
|
||||||
for (i=0; i<torture_numops; i++) {
|
for (i=0; i<torture_numops; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user