svn commit: samba r22962 - in branches/SAMBA_4_0/source/torture/raw: .
Author: tridge Date: 2007-05-17 02:22:29 + (Thu, 17 May 2007) New Revision: 22962 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22962 Log: show progress separately for each client in RAW-BENCH-LOCK, this is much more useful for seeing why we get unbalanced locking Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c Changeset: Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c === --- branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-17 02:21:07 UTC (rev 22961) +++ branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-17 02:22:29 UTC (rev 22962) @@ -54,6 +54,7 @@ int fnum; int offset; int count; + int lastcount; union smb_lock io; struct smb_lock_entry lock[2]; struct smbcli_request *req; @@ -216,6 +217,22 @@ } } + +static void report_rate(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private_data) +{ + struct benchlock_state *state = talloc_get_type(private_data, + struct benchlock_state); + int i; + for (i=0;inprocs;i++) { + printf(%5u , (unsigned)(state[i].count - state[i].lastcount)); + state[i].lastcount = state[i].count; + } + printf(\r); + fflush(stdout); + event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); +} + /* benchmark locking calls */ @@ -228,10 +245,13 @@ struct timeval tv; struct event_context *ev = event_context_find(mem_ctx); struct benchlock_state *state; - int total = 0, loops=0, minops=0; + int total = 0, minops=0; NTSTATUS status; struct smbcli_state *cli; - + bool progress; + + progress = torture_setting_bool(torture, progress, true); + nprocs = lp_parm_int(-1, torture, nprocs, 4); state = talloc_zero_array(mem_ctx, struct benchlock_state, nprocs); @@ -293,6 +313,10 @@ tv = timeval_current(); + if (progress) { + event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); + } + printf(Running for %d seconds\n, timelimit); while (timeval_elapsed(tv) timelimit) { event_loop_once(ev); @@ -301,19 +325,6 @@ DEBUG(0,(locking failed\n)); goto failed; } - - if (loops++ % 10 != 0) continue; - - total = 0; - for (i=0;inprocs;i++) { - total += state[i].count; - } - if (torture_setting_bool(torture, progress, true)) { - printf(%.2f ops/second (remaining=%u)\r, - total/timeval_elapsed(tv), - (unsigned)(timelimit - timeval_elapsed(tv))); - fflush(stdout); - } } printf(%.2f ops/second\n, total/timeval_elapsed(tv));
svn commit: samba r22963 - in branches/SAMBA_4_0/source/lib/events: .
Author: tridge Date: 2007-05-17 02:38:07 + (Thu, 17 May 2007) New Revision: 22963 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22963 Log: fixed the epoll/fork interaction in the epoll and aio backends Modified: branches/SAMBA_4_0/source/lib/events/events_aio.c branches/SAMBA_4_0/source/lib/events/events_epoll.c Changeset: Modified: branches/SAMBA_4_0/source/lib/events/events_aio.c === --- branches/SAMBA_4_0/source/lib/events/events_aio.c 2007-05-17 02:22:29 UTC (rev 22962) +++ branches/SAMBA_4_0/source/lib/events/events_aio.c 2007-05-17 02:38:07 UTC (rev 22963) @@ -48,6 +48,9 @@ /* a pointer back to the generic event_context */ struct event_context *ev; + /* list of filedescriptor events */ + struct fd_event *fd_events; + /* number of registered fd event handlers */ int num_fd_events; @@ -61,6 +64,7 @@ int epoll_fd; int is_epoll_set; + pid_t pid; }; struct aio_event { @@ -92,6 +96,28 @@ return 0; } +static void epoll_add_event(struct aio_event_context *aio_ev, struct fd_event *fde); + +/* + reopen the epoll handle when our pid changes + see http://junkcode.samba.org/ftp/unpacked/junkcode/epoll_fork.c for an + demonstration of why this is needed + */ +static void epoll_reopen(struct aio_event_context *aio_ev) +{ + struct fd_event *fde; + + close(aio_ev-epoll_fd); + aio_ev-epoll_fd = epoll_create(64); + if (aio_ev-epoll_fd == -1) { + return; + } + aio_ev-pid = getpid(); + for (fde=aio_ev-fd_events;fde;fde=fde-next) { + epoll_add_event(aio_ev, fde); + } +} + #define EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT (10) #define EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR (11) #define EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR (12) @@ -104,6 +130,16 @@ struct epoll_event event; if (aio_ev-epoll_fd == -1) return; + /* during an add event we need to check if our pid has changed + and re-open the epoll socket. Note that we don't need to do this + for other epoll changes */ + if (aio_ev-pid != getpid()) { + epoll_reopen(aio_ev); + /* the current event gets added in epoll_reopen(), so + we can return here */ + return; + } + fde-additional_flags = ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; /* if we don't want events yet, don't add an aio_event */ @@ -127,6 +163,9 @@ static void epoll_del_event(struct aio_event_context *aio_ev, struct fd_event *fde) { struct epoll_event event; + + DLIST_REMOVE(aio_ev-fd_events, fde); + if (aio_ev-epoll_fd == -1) return; fde-additional_flags = ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; @@ -185,6 +224,7 @@ /* there's no aio_event attached to the fde */ if (want_read || (want_write !got_error)) { + DLIST_ADD(aio_ev-fd_events, fde); epoll_add_event(aio_ev, fde); return; } @@ -334,6 +374,7 @@ talloc_free(aio_ev); return -1; } + aio_ev-pid = getpid(); talloc_set_destructor(aio_ev, aio_ctx_destructor); @@ -396,6 +437,7 @@ aio_ev-num_fd_events++; talloc_set_destructor(fde, aio_event_fd_destructor); + DLIST_ADD(aio_ev-fd_events, fde); epoll_add_event(aio_ev, fde); return fde; Modified: branches/SAMBA_4_0/source/lib/events/events_epoll.c === --- branches/SAMBA_4_0/source/lib/events/events_epoll.c 2007-05-17 02:22:29 UTC (rev 22962) +++ branches/SAMBA_4_0/source/lib/events/events_epoll.c 2007-05-17 02:38:07 UTC (rev 22963) @@ -32,6 +32,9 @@ /* a pointer back to the generic event_context */ struct event_context *ev; + /* list of filedescriptor events */ + struct fd_event *fd_events; + /* number of registered fd event handlers */ int num_fd_events; @@ -45,6 +48,8 @@ /* when using epoll this is the handle from epoll_create */ int epoll_fd; + + pid_t pid; }; /* @@ -86,9 +91,32 @@ static void epoll_init_ctx(struct epoll_event_context *epoll_ev) { epoll_ev-epoll_fd = epoll_create(64); + epoll_ev-pid = getpid(); talloc_set_destructor(epoll_ev, epoll_ctx_destructor); } +static void epoll_add_event(struct epoll_event_context *epoll_ev, struct fd_event *fde); + +/* + reopen the epoll handle when our pid changes + see http://junkcode.samba.org/ftp/unpacked/junkcode/epoll_fork.c for an + demonstration of why this is needed + */ +static void epoll_reopen(struct epoll_event_context *epoll_ev) +{ + struct fd_event *fde; + + close(epoll_ev-epoll_fd); + epoll_ev-epoll_fd = epoll_create(64); + if (epoll_ev-epoll_fd == -1
svn commit: samba r22964 - in branches/SAMBA_4_0/source/lib/events: .
Author: tridge Date: 2007-05-17 02:42:14 + (Thu, 17 May 2007) New Revision: 22964 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22964 Log: log an error on epoll_create failing on reopen Modified: branches/SAMBA_4_0/source/lib/events/events_aio.c branches/SAMBA_4_0/source/lib/events/events_epoll.c branches/SAMBA_4_0/source/lib/events/events_standard.c Changeset: Modified: branches/SAMBA_4_0/source/lib/events/events_aio.c === --- branches/SAMBA_4_0/source/lib/events/events_aio.c 2007-05-17 02:38:07 UTC (rev 22963) +++ branches/SAMBA_4_0/source/lib/events/events_aio.c 2007-05-17 02:42:14 UTC (rev 22964) @@ -108,8 +108,9 @@ struct fd_event *fde; close(aio_ev-epoll_fd); - aio_ev-epoll_fd = epoll_create(64); + aio_ev-epoll_fd = epoll_create(MAX_AIO_QUEUE_DEPTH); if (aio_ev-epoll_fd == -1) { + DEBUG(0,(Failed to recreate epoll handle after fork\n)); return; } aio_ev-pid = getpid(); Modified: branches/SAMBA_4_0/source/lib/events/events_epoll.c === --- branches/SAMBA_4_0/source/lib/events/events_epoll.c 2007-05-17 02:38:07 UTC (rev 22963) +++ branches/SAMBA_4_0/source/lib/events/events_epoll.c 2007-05-17 02:42:14 UTC (rev 22964) @@ -109,6 +109,7 @@ close(epoll_ev-epoll_fd); epoll_ev-epoll_fd = epoll_create(64); if (epoll_ev-epoll_fd == -1) { + DEBUG(0,(Failed to recreate epoll handle after fork\n)); return; } epoll_ev-pid = getpid(); Modified: branches/SAMBA_4_0/source/lib/events/events_standard.c === --- branches/SAMBA_4_0/source/lib/events/events_standard.c 2007-05-17 02:38:07 UTC (rev 22963) +++ branches/SAMBA_4_0/source/lib/events/events_standard.c 2007-05-17 02:42:14 UTC (rev 22964) @@ -126,6 +126,7 @@ close(std_ev-epoll_fd); std_ev-epoll_fd = epoll_create(64); if (std_ev-epoll_fd == -1) { + DEBUG(0,(Failed to recreate epoll handle after fork\n)); return; } std_ev-pid = getpid();
Rev 310: merged events changes from samba4 in http://samba.org/~tridge/ctdb
revno: 310 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-17 12:39:53 +1000 message: merged events changes from samba4 modified: lib/events/events_aio.cevents_aio.c-20070501213746-4fxluwiq4rcxib8p-1 lib/events/events_epoll.c events_epoll.c-20070501213746-4fxluwiq4rcxib8p-2 lib/events/events_standard.c events_standard.c-20061117234101-o3qt14umlg9en8z0-30 Diff too large for email (290, the limit is 200).
Rev 311: merged debug changes from samba4 in http://samba.org/~tridge/ctdb
revno: 311 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-17 12:43:09 +1000 message: merged debug changes from samba4 modified: lib/events/events_aio.cevents_aio.c-20070501213746-4fxluwiq4rcxib8p-1 lib/events/events_epoll.c events_epoll.c-20070501213746-4fxluwiq4rcxib8p-2 lib/events/events_standard.c events_standard.c-20061117234101-o3qt14umlg9en8z0-30 === modified file 'lib/events/events_aio.c' --- a/lib/events/events_aio.c 2007-05-17 02:39:53 + +++ b/lib/events/events_aio.c 2007-05-17 02:43:09 + @@ -108,8 +108,9 @@ struct fd_event *fde; close(aio_ev-epoll_fd); - aio_ev-epoll_fd = epoll_create(64); + aio_ev-epoll_fd = epoll_create(MAX_AIO_QUEUE_DEPTH); if (aio_ev-epoll_fd == -1) { + DEBUG(0,(Failed to recreate epoll handle after fork\n)); return; } aio_ev-pid = getpid(); === modified file 'lib/events/events_epoll.c' --- a/lib/events/events_epoll.c 2007-05-17 02:39:53 + +++ b/lib/events/events_epoll.c 2007-05-17 02:43:09 + @@ -109,6 +109,7 @@ close(epoll_ev-epoll_fd); epoll_ev-epoll_fd = epoll_create(64); if (epoll_ev-epoll_fd == -1) { + DEBUG(0,(Failed to recreate epoll handle after fork\n)); return; } epoll_ev-pid = getpid(); === modified file 'lib/events/events_standard.c' --- a/lib/events/events_standard.c 2007-05-17 02:39:53 + +++ b/lib/events/events_standard.c 2007-05-17 02:43:09 + @@ -126,6 +126,7 @@ close(std_ev-epoll_fd); std_ev-epoll_fd = epoll_create(64); if (std_ev-epoll_fd == -1) { + DEBUG(0,(Failed to recreate epoll handle after fork\n)); return; } std_ev-pid = getpid();
Rev 312: merge from ronnie in http://samba.org/~tridge/ctdb
revno: 312 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-17 12:46:50 +1000 message: merge from ronnie modified: common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 197.1.116 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-17 12:07:29 +1000 message: we no longer pass lmaster across during pulldbso dont print it from catdb either === modified file 'common/ctdb_client.c' --- a/common/ctdb_client.c 2007-05-17 00:45:31 + +++ b/common/ctdb_client.c 2007-05-17 02:07:29 + @@ -1109,7 +1109,6 @@ keys-keys = talloc_array(mem_ctx, TDB_DATA, keys-num); keys-headers = talloc_array(mem_ctx, struct ctdb_ltdb_header, keys-num); - keys-lmasters = talloc_array(mem_ctx, uint32_t, keys-num); keys-data = talloc_array(mem_ctx, TDB_DATA, keys-num); rec = (struct ctdb_rec_data *)reply-data[0]; @@ -1117,7 +1116,7 @@ for (i=0;ireply-count;i++) { keys-keys[i].dptr = talloc_memdup(mem_ctx, rec-data[0], rec-keylen); keys-keys[i].dsize = rec-keylen; - + keys-data[i].dptr = talloc_memdup(mem_ctx, rec-data[keys-keys[i].dsize], rec-datalen); keys-data[i].dsize = rec-datalen; === modified file 'include/ctdb.h' --- a/include/ctdb.h2007-05-17 00:45:31 + +++ b/include/ctdb.h2007-05-17 02:07:29 + @@ -244,7 +244,6 @@ uint32_t num; TDB_DATA *keys; struct ctdb_ltdb_header *headers; - uint32_t *lmasters; TDB_DATA *data; }; int ctdb_ctrl_pulldb(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid, uint32_t lmaster, TALLOC_CTX *mem_ctx, struct ctdb_key_list *keys); === modified file 'tools/ctdb_control.c' --- a/tools/ctdb_control.c 2007-05-17 00:45:31 + +++ b/tools/ctdb_control.c 2007-05-17 02:07:29 + @@ -513,8 +513,8 @@ keystr = hex_encode(ctdb, keys.keys[i].dptr, keys.keys[i].dsize); datastr = hex_encode(ctdb, keys.data[i].dptr, keys.data[i].dsize); - printf(rsn:%llu lmaster:%d dmaster:%d key:%s data:%s\n, - (unsigned long long)keys.headers[i].rsn, keys.lmasters[i], + printf(rsn:%llu dmaster:%d key:%s data:%s\n, + (unsigned long long)keys.headers[i].rsn, keys.headers[i].dmaster, keystr, datastr); ret++; }
svn commit: samba r22965 - in branches/SAMBA_4_0/source/torture/raw: .
Author: tridge Date: 2007-05-17 03:42:28 + (Thu, 17 May 2007) New Revision: 22965 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22965 Log: changed RAW-LOCK-BENCH to remove the scheduling uncertainty. We should always get balanced locking now Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c Changeset: Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c === --- branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-17 02:42:14 UTC (rev 22964) +++ branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-17 03:42:28 UTC (rev 22965) @@ -32,13 +32,6 @@ #include libcli/composite/composite.h #include libcli/smb_composite/smb_composite.h -#define CHECK_STATUS(status, correct) do { \ - if (!NT_STATUS_EQUAL(status, correct)) { \ - printf((%s) Incorrect status %s - should be %s\n, \ - __location__, nt_errstr(status), nt_errstr(correct)); \ - goto failed; \ - }} while (0) - #define BASEDIR \\benchlock #define FNAME BASEDIR \\lock.dat @@ -46,17 +39,19 @@ static int lock_failed; static int num_connected; +enum lock_stage {LOCK_INITIAL, LOCK_LOCK, LOCK_UNLOCK}; + struct benchlock_state { struct event_context *ev; struct smbcli_tree *tree; TALLOC_CTX *mem_ctx; int client_num; int fnum; - int offset; + enum lock_stage stage; + int lock_offset; + int unlock_offset; int count; int lastcount; - union smb_lock io; - struct smb_lock_entry lock[2]; struct smbcli_request *req; struct smb_composite_connect reconnect; @@ -74,20 +69,47 @@ */ static void lock_send(struct benchlock_state *state) { - state-io.lockx.in.file.fnum = state-fnum; - state-io.lockx.in.ulock_cnt = 1; - state-lock[0].pid = state-tree-session-pid; - state-lock[1].pid = state-tree-session-pid; - state-lock[0].offset = state-offset; - state-lock[1].offset = (state-offset+1)%nprocs; - state-req = smb_raw_lock_send(state-tree, state-io); + union smb_lock io; + struct smb_lock_entry lock; + + switch (state-stage) { + case LOCK_INITIAL: + io.lockx.in.ulock_cnt = 0; + io.lockx.in.lock_cnt = 1; + state-lock_offset = 0; + state-unlock_offset = 0; + lock.offset = state-lock_offset; + break; + case LOCK_LOCK: + io.lockx.in.ulock_cnt = 0; + io.lockx.in.lock_cnt = 1; + state-lock_offset = (state-lock_offset+1)%(nprocs+1); + lock.offset = state-lock_offset; + break; + case LOCK_UNLOCK: + io.lockx.in.ulock_cnt = 1; + io.lockx.in.lock_cnt = 0; + lock.offset = state-unlock_offset; + state-unlock_offset = (state-unlock_offset+1)%(nprocs+1); + break; + } + + lock.count = 1; + lock.pid = state-tree-session-pid; + + io.lockx.level = RAW_LOCK_LOCKX; + io.lockx.in.mode = LOCKING_ANDX_LARGE_FILES; + io.lockx.in.timeout = 10; + io.lockx.in.locks = lock; + io.lockx.in.file.fnum = state-fnum; + + state-req = smb_raw_lock_send(state-tree, io); if (state-req == NULL) { DEBUG(0,(Failed to setup lock\n)); lock_failed++; } state-req-async.private = state; state-req-async.fn = lock_completion; - state-offset = (state-offset+1)%nprocs; } static void reopen_connection(struct event_context *ev, struct timed_event *te, @@ -106,22 +128,13 @@ exit(1); } - /* reestablish one lock, preparing for the async lock loop */ - state-lock[0].offset = state-offset; - state-io.lockx.in.ulock_cnt = 0; - state-io.lockx.in.file.fnum = state-fnum; - state-req = smb_raw_lock_send(state-tree, state-io); - if (state-req == NULL) { - DEBUG(0,(Failed to setup lock\n)); - lock_failed++; - } - state-req-async.private = state; - state-req-async.fn = lock_completion; - num_connected++; DEBUG(0,(reconnect to %s finished (%u connected)\n, state-dest_host, num_connected)); + + state-stage = LOCK_INITIAL; + lock_send(state); } /* @@ -211,10 +224,23 @@ DEBUG(0,(Lock failed - %s\n, nt_errstr(status))); lock_failed++; } - } else { - state-count++; - lock_send(state); + return; } + + switch (state-stage) { + case LOCK_INITIAL: + state-stage = LOCK_LOCK; + break; + case LOCK_LOCK: + state-stage = LOCK_UNLOCK; + break; + case
svn commit: samba r22885 - in branches/SAMBA_4_0/source/setup: .
Author: tridge Date: 2007-05-15 08:00:49 + (Tue, 15 May 2007) New Revision: 22885 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22885 Log: now we use kernberos more, we need to index on userPrincipalName Modified: branches/SAMBA_4_0/source/setup/provision_index.ldif Changeset: Modified: branches/SAMBA_4_0/source/setup/provision_index.ldif === --- branches/SAMBA_4_0/source/setup/provision_index.ldif2007-05-15 07:16:04 UTC (rev 22884) +++ branches/SAMBA_4_0/source/setup/provision_index.ldif2007-05-15 08:00:49 UTC (rev 22885) @@ -1,5 +1,6 @@ dn: @INDEXLIST @IDXATTR: name [EMAIL PROTECTED]: userPrincipalName @IDXATTR: sAMAccountName @IDXATTR: objectSid @IDXATTR: objectCategory
svn commit: samba r22887 - in branches/SAMBA_4_0/source/setup: .
Author: tridge Date: 2007-05-15 08:01:37 + (Tue, 15 May 2007) New Revision: 22887 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22887 Log: and servicePrincipalName Modified: branches/SAMBA_4_0/source/setup/provision_index.ldif Changeset: Modified: branches/SAMBA_4_0/source/setup/provision_index.ldif === --- branches/SAMBA_4_0/source/setup/provision_index.ldif2007-05-15 08:01:30 UTC (rev 22886) +++ branches/SAMBA_4_0/source/setup/provision_index.ldif2007-05-15 08:01:37 UTC (rev 22887) @@ -1,6 +1,7 @@ dn: @INDEXLIST @IDXATTR: name @IDXATTR: userPrincipalName [EMAIL PROTECTED]: servicePrincipalName @IDXATTR: sAMAccountName @IDXATTR: objectSid @IDXATTR: objectCategory
Rev 307: enable TCP keepalives in http://samba.org/~tridge/ctdb
revno: 307 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Tue 2007-05-15 18:40:56 +1000 message: enable TCP keepalives modified: tcp/tcp_connect.c tcp_connect.c-20061128004937-x70q1cu5xzg5g2tm-1 === modified file 'tcp/tcp_connect.c' --- a/tcp/tcp_connect.c 2007-05-15 04:08:58 + +++ b/tcp/tcp_connect.c 2007-05-15 08:40:56 + @@ -82,6 +82,7 @@ talloc_free(fde); setsockopt(tnode-fd,IPPROTO_TCP,TCP_NODELAY,(char *)one,sizeof(one)); +setsockopt(tnode-fd,SOL_SOCKET,SO_KEEPALIVE,(char *)one,sizeof(one)); ctdb_queue_set_fd(tnode-queue, tnode-fd); @@ -180,6 +181,7 @@ socklen_t len; int fd; struct ctdb_incoming *in; + int one = 1; ctdb = talloc_get_type(private_data, struct ctdb_context); ctcp = talloc_get_type(ctdb-private_data, struct ctdb_tcp); @@ -194,6 +196,8 @@ set_nonblocking(in-fd); +setsockopt(in-fd,SOL_SOCKET,SO_KEEPALIVE,(char *)one,sizeof(one)); + in-queue = ctdb_queue_setup(ctdb, in, in-fd, CTDB_TCP_ALIGNMENT, ctdb_tcp_read_cb, in); }
Rev 303: added a control to get the local vnn in http://samba.org/~tridge/ctdb
revno: 303 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Tue 2007-05-15 10:17:16 +1000 message: added a control to get the local vnn modified: common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 === modified file 'common/ctdb_control.c' --- a/common/ctdb_control.c 2007-05-14 03:48:14 + +++ b/common/ctdb_control.c 2007-05-15 00:17:16 + @@ -132,13 +132,14 @@ return 0; } - case CTDB_CONTROL_GET_RECMASTER: { + case CTDB_CONTROL_GET_RECMASTER: return ctdb-recovery_master; - } - case CTDB_CONTROL_GET_PID: { + case CTDB_CONTROL_GET_PID: return getpid(); - } + + case CTDB_CONTROL_GET_VNN: + return ctdb-vnn; case CTDB_CONTROL_CONFIG: { CHECK_CONTROL_DATA_SIZE(0); === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2007-05-12 11:25:26 + +++ b/include/ctdb_private.h2007-05-15 00:17:16 + @@ -352,6 +352,7 @@ CTDB_CONTROL_SET_RECMASTER, CTDB_CONTROL_FREEZE, CTDB_CONTROL_THAW, + CTDB_CONTROL_GET_VNN, };
Rev 301: added a -i switch to run ctdbd without forking in http://samba.org/~tridge/ctdb
revno: 301 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Tue 2007-05-15 09:44:33 +1000 message: added a -i switch to run ctdbd without forking modified: common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 direct/ctdbd.c ctdbd.c-20070411085044-dqmhr6mfeexnyt4m-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-12 23:20:16 + +++ b/common/ctdb_daemon.c 2007-05-14 23:44:33 + @@ -62,7 +62,10 @@ } /* start the transport running */ - ctdb-methods-start(ctdb); + if (ctdb-methods-start(ctdb) != 0) { + DEBUG(0,(transport failed to start!\n)); + ctdb_fatal(ctdb, transport failed to start); + } /* go into a wait loop to allow other nodes to complete */ event_loop_wait(ctdb-ev); @@ -603,11 +606,14 @@ return -1; } +#if 0 + /* AIX doesn't like this :( */ if (fchown(ctdb-daemon.sd, geteuid(), getegid()) != 0 || fchmod(ctdb-daemon.sd, 0700) != 0) { DEBUG(0,(Unable to secure ctdb socket '%s', ctdb-daemon.name\n)); goto failed; } +#endif set_non_blocking(ctdb-daemon.sd); @@ -701,7 +707,7 @@ /* start the protocol going as a daemon */ -int ctdb_start_daemon(struct ctdb_context *ctdb) +int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork) { int res; struct fd_event *fde; @@ -717,13 +723,15 @@ exit(10); } - if (fork()) { + if (do_fork fork()) { return 0; } tdb_reopen_all(False); - setsid(); + if (do_fork) { + setsid(); + } block_signal(SIGPIPE); block_signal(SIGCHLD); === modified file 'direct/ctdbd.c' --- a/direct/ctdbd.c2007-04-30 13:31:40 + +++ b/direct/ctdbd.c2007-05-14 23:44:33 + @@ -45,10 +45,12 @@ int main(int argc, const char *argv[]) { struct ctdb_context *ctdb; + int interactive = 0; struct poptOption popt_options[] = { POPT_AUTOHELP POPT_CTDB_CMDLINE + { interactive, 'i', POPT_ARG_NONE, interactive, 0, don't fork, NULL }, POPT_TABLEEND }; int opt; @@ -90,5 +92,5 @@ } /* start the protocol running (as a child) */ - return ctdb_start_daemon(ctdb); + return ctdb_start_daemon(ctdb, interactive?False:True); } === modified file 'include/ctdb.h' --- a/include/ctdb.h2007-05-12 05:15:27 + +++ b/include/ctdb.h2007-05-14 23:44:33 + @@ -112,7 +112,7 @@ start the ctdb protocol */ int ctdb_start(struct ctdb_context *ctdb); -int ctdb_start_daemon(struct ctdb_context *ctdb); +int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork); /* attach to a ctdb database
Rev 300: reading on the write side of a pipe isn't allowed - this caused us to run without locking in the lockwait code in http://samba.org/~tridge/ctdb
revno: 300 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Tue 2007-05-15 09:44:03 +1000 message: reading on the write side of a pipe isn't allowed - this caused us to run without locking in the lockwait code modified: common/ctdb_lockwait.c ctdb_lockwait.c-20070416214118-n1aeonljj3vpdd9q-1 === modified file 'common/ctdb_lockwait.c' --- a/common/ctdb_lockwait.c2007-05-14 04:01:33 + +++ b/common/ctdb_lockwait.c2007-05-14 23:44:03 + @@ -57,10 +57,16 @@ ctdb_latency(h-ctdb-status.max_lockwait_latency, h-start_time); h-ctdb-status.pending_lockwait_calls--; - /* the fde needs to go away when the context is gone - when - the fde goes away this implicitly closes the pipe, which + /* the handle needs to go away when the context is gone - when + the handle goes away this implicitly closes the pipe, which kills the child holding the lock */ - talloc_steal(tmp_ctx, fde); + talloc_steal(tmp_ctx, h); + + if (h-ctdb-flags CTDB_FLAG_TORTURE) { + if (tdb_chainlock_nonblock(tdb, key) == 0) { + ctdb_fatal(h-ctdb, got chain lock while lockwait child active); + } + } tdb_chainlock_mark(tdb, key); callback(p); @@ -96,6 +102,7 @@ { struct lockwait_handle *result; int ret; + pid_t parent = getpid(); ctdb_db-ctdb-status.lockwait_calls++; ctdb_db-ctdb-status.pending_lockwait_calls++; @@ -134,9 +141,10 @@ close(result-fd[0]); tdb_chainlock(ctdb_db-ltdb-tdb, key); write(result-fd[1], c, 1); - /* this read will exit when the parent closes its end - of the pipe, or the parent dies */ - read(result-fd[1], c, 1); + /* make sure we die when our parent dies */ + while (kill(parent, 0) == 0 || errno != ESRCH) { + sleep(5); + } _exit(0); }
Rev 302: check for error on ctdb_ltdb_store in http://samba.org/~tridge/ctdb
revno: 302 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Tue 2007-05-15 10:16:59 +1000 message: check for error on ctdb_ltdb_store modified: common/ctdb_call.c ctdb_call.c-20061128065342-to93h6eejj5kon81-1 === modified file 'common/ctdb_call.c' --- a/common/ctdb_call.c2007-05-12 09:55:18 + +++ b/common/ctdb_call.c2007-05-15 00:16:59 + @@ -271,7 +271,9 @@ memcpy(r-data[key-dsize], data-dptr, data-dsize); header-dmaster = c-hdr.srcnode; - ctdb_ltdb_store(ctdb_db, *key, header, *data); + if (ctdb_ltdb_store(ctdb_db, *key, header, *data) != 0) { + ctdb_fatal(ctdb, Failed to store record in ctdb_call_send_dmaster); + } ctdb_queue_packet(ctdb, r-hdr);
Rev 299: AIX needs sin_len field for bind() in http://samba.org/~tridge/ctdb
revno: 299 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Tue 2007-05-15 09:42:52 +1000 message: AIX needs sin_len field for bind() modified: configure.ac configure.ac-20061117234101-o3qt14umlg9en8z0-10 tcp/tcp_connect.c tcp_connect.c-20061128004937-x70q1cu5xzg5g2tm-1 === modified file 'configure.ac' --- a/configure.ac 2007-05-05 07:18:06 + +++ b/configure.ac 2007-05-14 23:42:52 + @@ -30,6 +30,16 @@ m4_include(libevents.m4) m4_include(ib/config.m4) +AC_CACHE_CHECK([for sin_len in sock],ctdb_cv_HAVE_SOCK_SIN_LEN,[ +AC_TRY_COMPILE([#include sys/types.h +#include sys/socket.h +#include netinet/in.h], +[struct sockaddr_in sock; sock.sin_len = sizeof(sock);], +ctdb_cv_HAVE_SOCK_SIN_LEN=yes,ctdb_cv_HAVE_SOCK_SIN_LEN=no)]) +if test x$ctdb_cv_HAVE_SOCK_SIN_LEN = xyes; then +AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property]) +fi + AC_SUBST(EXTRA_OBJ) AC_OUTPUT(Makefile) === modified file 'tcp/tcp_connect.c' --- a/tcp/tcp_connect.c 2007-05-01 03:25:02 + +++ b/tcp/tcp_connect.c 2007-05-14 23:42:52 + @@ -125,6 +125,10 @@ set_nonblocking(tnode-fd); + ZERO_STRUCT(sock_out); +#ifdef HAVE_SOCK_SIN_LEN + sock_out.sin_len = sizeof(sock_out); +#endif if (ctdb_tcp_get_address(ctdb, node-address.address, sock_out.sin_addr) != 0) { return; } @@ -138,6 +142,10 @@ * the remote side is actually routable in case CTDB traffic will run on * a dedicated non-routeable network. */ + ZERO_STRUCT(sock_in); +#ifdef HAVE_SOCK_SIN_LEN + sock_in.sin_len = sizeof(sock_in); +#endif if (ctdb_tcp_get_address(ctdb, ctdb-address.address, sock_in.sin_addr) != 0) { return; } @@ -239,6 +247,10 @@ } for (i=0;ictdb-num_nodes;i++) { + ZERO_STRUCT(sock); +#ifdef HAVE_SOCK_SIN_LEN + sock.sin_len = sizeof(sock); +#endif sock.sin_port = htons(ctdb-nodes[i]-address.port); sock.sin_family = PF_INET; if (ctdb_tcp_get_address(ctdb, ctdb-nodes[i]-address.address, @@ -309,6 +321,10 @@ return ctdb_tcp_listen_automatic(ctdb); } + ZERO_STRUCT(sock); +#ifdef HAVE_SOCK_SIN_LEN + sock.sin_len = sizeof(sock); +#endif sock.sin_port = htons(ctdb-address.port); sock.sin_family = PF_INET;
Rev 304: fixed a fd close error on reconnect in http://samba.org/~tridge/ctdb
revno: 304 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Tue 2007-05-15 10:33:28 +1000 message: fixed a fd close error on reconnect modified: tcp/tcp_connect.c tcp_connect.c-20061128004937-x70q1cu5xzg5g2tm-1 === modified file 'tcp/tcp_connect.c' --- a/tcp/tcp_connect.c 2007-05-14 23:42:52 + +++ b/tcp/tcp_connect.c 2007-05-15 00:33:28 + @@ -168,16 +168,6 @@ } /* - destroy a ctdb_incoming structure -*/ -static int ctdb_incoming_destructor(struct ctdb_incoming *in) -{ - close(in-fd); - in-fd = -1; - return 0; -} - -/* called when we get contacted by another node currently makes no attempt to check if the connection is really from a ctdb node in our cluster @@ -207,8 +197,6 @@ in-queue = ctdb_queue_setup(ctdb, in, in-fd, CTDB_TCP_ALIGNMENT, ctdb_tcp_read_cb, in); - - talloc_set_destructor(in, ctdb_incoming_destructor); }
svn commit: samba r22876 - in branches/SAMBA_4_0/source/torture/raw: .
Author: tridge Date: 2007-05-15 03:00:58 + (Tue, 15 May 2007) New Revision: 22876 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22876 Log: - try to reconnect once per second, not continously - patch from ronnie to fix the lock offset on reconnect Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c Changeset: Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c === --- branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-15 01:57:21 UTC (rev 22875) +++ branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-15 03:00:58 UTC (rev 22876) @@ -88,7 +88,8 @@ state-offset = (state-offset+1)%nprocs; } -static void reopen_connection(struct benchlock_state *state); +static void reopen_connection(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private_data); static void reopen_file(struct event_context *ev, struct timed_event *te, @@ -114,7 +115,6 @@ } state-req-async.private = state; state-req-async.fn = lock_completion; - state-offset = (state-offset+1)%nprocs; } /* @@ -128,7 +128,9 @@ status = smb_composite_connect_recv(ctx, state-mem_ctx); if (!NT_STATUS_IS_OK(status)) { - reopen_connection(state); + event_add_timed(state-ev, state-mem_ctx, + timeval_current_ofs(1,0), + reopen_connection, state); return; } @@ -142,10 +144,12 @@ /* - reopen dead connections + reopen a connection */ -static void reopen_connection(struct benchlock_state *state) +static void reopen_connection(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private_data) { + struct benchlock_state *state = (struct benchlock_state *)private_data; struct composite_context *ctx; struct smb_composite_connect *io = state-reconnect; char *host, *share; @@ -191,7 +195,9 @@ state-req = NULL; if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { - reopen_connection(state); + event_add_timed(state-ev, state-mem_ctx, + timeval_current_ofs(1,0), + reopen_connection, state); } else { DEBUG(0,(Lock failed - %s\n, nt_errstr(status))); lock_failed++;
Rev 305: fixed two more places where we don't correctly handle write errors on sockets in http://samba.org/~tridge/ctdb
revno: 305 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Tue 2007-05-15 14:08:58 +1000 message: fixed two more places where we don't correctly handle write errors on sockets modified: common/ctdb_io.c ctdb_io.c-20070409200335-dzfc7f3rra5rcf60-1 tcp/tcp_connect.c tcp_connect.c-20061128004937-x70q1cu5xzg5g2tm-1 === modified file 'common/ctdb_io.c' --- a/common/ctdb_io.c 2007-05-05 07:19:59 + +++ b/common/ctdb_io.c 2007-05-15 04:08:58 + @@ -170,9 +170,11 @@ } if (n == -1 errno != EAGAIN errno != EWOULDBLOCK) { + talloc_free(queue-fde); + queue-fde = NULL; + queue-fd = -1; event_add_timed(queue-ctdb-ev, queue, timeval_zero(), queue_dead, queue); - EVENT_FD_NOT_WRITEABLE(queue-fde); return; } if (n = 0) return; @@ -232,6 +234,9 @@ !(queue-ctdb-flags CTDB_FLAG_TORTURE)) { ssize_t n = write(queue-fd, data, length2); if (n == -1 errno != EAGAIN errno != EWOULDBLOCK) { + talloc_free(queue-fde); + queue-fde = NULL; + queue-fd = -1; event_add_timed(queue-ctdb-ev, queue, timeval_zero(), queue_dead, queue); /* yes, we report success, as the dead node is === modified file 'tcp/tcp_connect.c' --- a/tcp/tcp_connect.c 2007-05-15 00:33:28 + +++ b/tcp/tcp_connect.c 2007-05-15 04:08:58 + @@ -49,9 +49,7 @@ /* start a new connect cycle to try to re-establish the link */ - close(tnode-fd); ctdb_queue_set_fd(tnode-queue, -1); - tnode-fd = -1; event_add_timed(node-ctdb-ev, node, timeval_zero(), ctdb_tcp_node_connect, node); } @@ -157,6 +155,7 @@ errno != EINPROGRESS) { /* try again once a second */ close(tnode-fd); + tnode-fd = -1; event_add_timed(ctdb-ev, node, timeval_current_ofs(1, 0), ctdb_tcp_node_connect, node); return;
Rev 306: moved the recovery daemon into the main ctdbd and enable it by default in http://samba.org/~tridge/ctdb
revno: 306 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Tue 2007-05-15 15:13:36 +1000 message: moved the recovery daemon into the main ctdbd and enable it by default renamed: direct/ctdb_recoverd.c = common/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 common/cmdline.c cmdline.c-20070416041216-w1zvz91bkdsgjckw-1 common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tests/recover.sh recover.sh-20070502031230-tpuiet6m6tjdotta-1 tools/monitor_recovery.sh monitor_recovery.sh-20070508220533-oy7s689rcjsu7yte-1 common/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 Diff too large for email (381, the limit is 200).
svn commit: samba r22881 - in branches/SAMBA_4_0/source/torture/raw: .
Author: tridge Date: 2007-05-15 05:42:16 + (Tue, 15 May 2007) New Revision: 22881 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22881 Log: show number of connected clients Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c Changeset: Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c === --- branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-15 05:38:33 UTC (rev 22880) +++ branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-15 05:42:16 UTC (rev 22881) @@ -44,6 +44,7 @@ static int nprocs; static int lock_failed; +static int num_connected; struct benchlock_state { struct event_context *ev; @@ -115,6 +116,11 @@ } state-req-async.private = state; state-req-async.fn = lock_completion; + + num_connected++; + + DEBUG(0,(reconnect to %s finished (%u connected)\n, state-dest_host, +num_connected)); } /* @@ -168,8 +174,6 @@ io-in.fallback_to_anonymous = False; io-in.workgroup= lp_workgroup(); - DEBUG(0,(reopening connection to //%s/%s\n, host, share)); - /* kill off the remnants of the old connection */ talloc_free(state-tree); state-tree = NULL; @@ -195,6 +199,10 @@ state-req = NULL; if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { + talloc_free(state-tree); + state-tree = NULL; + num_connected--; + DEBUG(0,(reopening connection to %s\n, state-dest_host)); event_add_timed(state-ev, state-mem_ctx, timeval_current_ofs(1,0), reopen_connection, state); @@ -247,6 +255,8 @@ cli-tree-device); } + num_connected = i; + if (!torture_setup_dir(cli, BASEDIR)) { goto failed; }
svn commit: samba r22829 - in branches/SAMBA_4_0/source/lib/replace/system: .
Author: tridge Date: 2007-05-14 00:31:04 + (Mon, 14 May 2007) New Revision: 22829 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22829 Log: system/select.h needs to bring in epoll.h for epoll usage in lib/events Modified: branches/SAMBA_4_0/source/lib/replace/system/select.h Changeset: Modified: branches/SAMBA_4_0/source/lib/replace/system/select.h === --- branches/SAMBA_4_0/source/lib/replace/system/select.h 2007-05-13 20:51:39 UTC (rev 22828) +++ branches/SAMBA_4_0/source/lib/replace/system/select.h 2007-05-14 00:31:04 UTC (rev 22829) @@ -31,6 +31,10 @@ #include sys/select.h #endif +#ifdef HAVE_SYS_EPOLL_H +#include sys/epoll.h +#endif + #ifndef SELECT_CAST #define SELECT_CAST #endif
svn commit: samba r22830 - in branches/SAMBA_4_0/source/lib/events: .
Author: tridge Date: 2007-05-14 00:57:48 + (Mon, 14 May 2007) New Revision: 22830 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22830 Log: merged the latest lib/events updates from ctdb to Samba4. This includes a new EVENT_FD_AUTOCLOSE flag that prevents race conditions where code using fd events might close a fd before releasing the struct fd_event. That causes headaches for epoll. Added: branches/SAMBA_4_0/source/lib/events/libevents.m4 Modified: branches/SAMBA_4_0/source/lib/events/config.m4 branches/SAMBA_4_0/source/lib/events/events.c branches/SAMBA_4_0/source/lib/events/events.h branches/SAMBA_4_0/source/lib/events/events_aio.c branches/SAMBA_4_0/source/lib/events/events_epoll.c branches/SAMBA_4_0/source/lib/events/events_liboop.c branches/SAMBA_4_0/source/lib/events/events_select.c branches/SAMBA_4_0/source/lib/events/events_standard.c Changeset: Modified: branches/SAMBA_4_0/source/lib/events/config.m4 === --- branches/SAMBA_4_0/source/lib/events/config.m4 2007-05-14 00:31:04 UTC (rev 22829) +++ branches/SAMBA_4_0/source/lib/events/config.m4 2007-05-14 00:57:48 UTC (rev 22830) @@ -5,6 +5,7 @@ AC_CHECK_FUNCS(epoll_create) if test x$ac_cv_header_sys_epoll_h = xyes -a x$ac_cv_func_epoll_create = xyes;then SMB_ENABLE(EVENTS_EPOLL,YES) + AC_DEFINE(HAVE_EVENTS_EPOLL, 1, [Whether epoll is available]) # check for native Linux AIO interface AC_CHECK_HEADERS(libaio.h) Modified: branches/SAMBA_4_0/source/lib/events/events.c === --- branches/SAMBA_4_0/source/lib/events/events.c 2007-05-14 00:31:04 UTC (rev 22829) +++ branches/SAMBA_4_0/source/lib/events/events.c 2007-05-14 00:57:48 UTC (rev 22830) @@ -71,6 +71,8 @@ /* list of registered event backends */ static struct event_ops_list *event_backends; +static char *event_default_backend = NULL; + /* register an events backend */ @@ -86,6 +88,15 @@ } /* + set the default event backend + */ +void event_set_default_backend(const char *backend) +{ + if (event_default_backend) free(event_default_backend); + event_default_backend = strdup(backend); +} + +/* initialise backends if not already done */ static void event_backend_init(void) @@ -99,8 +110,16 @@ run_init_functions(shared_init); #else bool events_standard_init(void); + bool events_select_init(void); + events_select_init(); events_standard_init(); +#if HAVE_EVENTS_EPOLL + { + bool events_epoll_init(void); + events_epoll_init(); + } #endif +#endif } /* @@ -170,6 +189,9 @@ } #endif if (name == NULL) { + name = event_default_backend; + } + if (name == NULL) { name = standard; } @@ -195,6 +217,9 @@ /* add a fd based event return NULL on failure (memory allocation error) + + if flags contains EVENT_FD_AUTOCLOSE then the fd will be closed when + the returned fd_event context is freed */ struct fd_event *event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx, int fd, uint16_t flags, event_fd_handler_t handler, Modified: branches/SAMBA_4_0/source/lib/events/events.h === --- branches/SAMBA_4_0/source/lib/events/events.h 2007-05-14 00:31:04 UTC (rev 22829) +++ branches/SAMBA_4_0/source/lib/events/events.h 2007-05-14 00:57:48 UTC (rev 22830) @@ -46,6 +46,7 @@ struct event_context *event_context_init(TALLOC_CTX *mem_ctx); struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char *name); const char **event_backend_list(TALLOC_CTX *mem_ctx); +void event_set_default_backend(const char *backend); struct fd_event *event_add_fd(struct event_context *ev, TALLOC_CTX *mem_ctx, int fd, uint16_t flags, event_fd_handler_t handler, @@ -79,6 +80,7 @@ /* bits for file descriptor event flags */ #define EVENT_FD_READ 1 #define EVENT_FD_WRITE 2 +#define EVENT_FD_AUTOCLOSE 4 #define EVENT_FD_WRITEABLE(fde) \ event_set_fd_flags(fde, event_get_fd_flags(fde) | EVENT_FD_WRITE) Modified: branches/SAMBA_4_0/source/lib/events/events_aio.c === --- branches/SAMBA_4_0/source/lib/events/events_aio.c 2007-05-14 00:31:04 UTC (rev 22829) +++ branches/SAMBA_4_0/source/lib/events/events_aio.c 2007-05-14 00:57:48 UTC (rev 22830) @@ -361,6 +361,11 @@ epoll_del_event(aio_ev, fde); + if (fde-flags EVENT_FD_AUTOCLOSE) { + close(fde-fd); + fde-fd = -1; + } + return 0; } Modified: branches/SAMBA_4_0/source/lib/events/events_epoll.c
svn commit: samba r22831 - in branches/SAMBA_4_0/source/ntvfs/sysdep: .
Author: tridge Date: 2007-05-14 00:58:24 + (Mon, 14 May 2007) New Revision: 22831 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22831 Log: take advantage of EVENT_FD_AUTOCLOSE in the inotify code Modified: branches/SAMBA_4_0/source/ntvfs/sysdep/inotify.c Changeset: Modified: branches/SAMBA_4_0/source/ntvfs/sysdep/inotify.c === --- branches/SAMBA_4_0/source/ntvfs/sysdep/inotify.c2007-05-14 00:57:48 UTC (rev 22830) +++ branches/SAMBA_4_0/source/ntvfs/sysdep/inotify.c2007-05-14 00:58:24 UTC (rev 22831) @@ -80,16 +80,6 @@ /* - destroy the inotify private context -*/ -static int inotify_destructor(struct inotify_private *in) -{ - close(in-fd); - return 0; -} - - -/* see if a particular event from inotify really does match a requested notify event in SMB */ @@ -271,10 +261,9 @@ in-watches = NULL; ctx-private_data = in; - talloc_set_destructor(in, inotify_destructor); /* add a event waiting for the inotify fd to be readable */ - event_add_fd(ctx-ev, in, in-fd, EVENT_FD_READ, inotify_handler, in); + event_add_fd(ctx-ev, in, in-fd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE, inotify_handler, in); return NT_STATUS_OK; }
svn commit: samba r22832 - in branches/SAMBA_4_0/source/lib/tdb: common include
Author: tridge Date: 2007-05-14 01:00:06 + (Mon, 14 May 2007) New Revision: 22832 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22832 Log: merged the latest tdb changes from ctdb to Samba4 Modified: branches/SAMBA_4_0/source/lib/tdb/common/lock.c branches/SAMBA_4_0/source/lib/tdb/common/tdb.c branches/SAMBA_4_0/source/lib/tdb/include/tdb.h Changeset: Modified: branches/SAMBA_4_0/source/lib/tdb/common/lock.c === --- branches/SAMBA_4_0/source/lib/tdb/common/lock.c 2007-05-14 00:58:24 UTC (rev 22831) +++ branches/SAMBA_4_0/source/lib/tdb/common/lock.c 2007-05-14 01:00:06 UTC (rev 22832) @@ -28,6 +28,8 @@ #include tdb_private.h +#define TDB_MARK_LOCK 0x8000 + /* a byte range locking function - return 0 on success this functions locks/unlocks 1 byte at the specified offset. @@ -109,7 +111,10 @@ { struct tdb_lock_type *new_lck; int i; + bool mark_lock = ((ltype TDB_MARK_LOCK) == TDB_MARK_LOCK); + ltype = ~TDB_MARK_LOCK; + /* a global lock allows us to avoid per chain locks */ if (tdb-global_lock.count (ltype == tdb-global_lock.ltype || ltype == F_RDLCK)) { @@ -158,7 +163,8 @@ /* Since fcntl locks don't nest, we do a lock for the first one, and simply bump the count for future ones */ - if (tdb-methods-tdb_brlock(tdb,FREELIST_TOP+4*list,ltype, op, + if (!mark_lock + tdb-methods-tdb_brlock(tdb,FREELIST_TOP+4*list, ltype, op, 0, 1)) { return -1; } @@ -200,7 +206,10 @@ int ret = -1; int i; struct tdb_lock_type *lck = NULL; + bool mark_lock = ((ltype TDB_MARK_LOCK) == TDB_MARK_LOCK); + ltype = ~TDB_MARK_LOCK; + /* a global lock allows us to avoid per chain locks */ if (tdb-global_lock.count (ltype == tdb-global_lock.ltype || ltype == F_RDLCK)) { @@ -244,8 +253,12 @@ * anyway. */ - ret = tdb-methods-tdb_brlock(tdb, FREELIST_TOP+4*list, F_UNLCK, - F_SETLKW, 0, 1); + if (mark_lock) { + ret = 0; + } else { + ret = tdb-methods-tdb_brlock(tdb, FREELIST_TOP+4*list, F_UNLCK, + F_SETLKW, 0, 1); + } tdb-num_locks--; /* @@ -275,8 +288,12 @@ /* lock/unlock entire database */ -static int _tdb_lockall(struct tdb_context *tdb, int ltype) +static int _tdb_lockall(struct tdb_context *tdb, int ltype, int op) { + bool mark_lock = ((ltype TDB_MARK_LOCK) == TDB_MARK_LOCK); + + ltype = ~TDB_MARK_LOCK; + /* There are no locks on read-only dbs */ if (tdb-read_only || tdb-traverse_read) return TDB_ERRCODE(TDB_ERR_LOCK, -1); @@ -296,9 +313,12 @@ return TDB_ERRCODE(TDB_ERR_LOCK, -1); } - if (tdb-methods-tdb_brlock(tdb, FREELIST_TOP, ltype, F_SETLKW, + if (!mark_lock + tdb-methods-tdb_brlock(tdb, FREELIST_TOP, ltype, op, 0, 4*tdb-header.hash_size)) { - TDB_LOG((tdb, TDB_DEBUG_ERROR, tdb_lockall failed (%s)\n, strerror(errno))); + if (op == F_SETLKW) { + TDB_LOG((tdb, TDB_DEBUG_ERROR, tdb_lockall failed (%s)\n, strerror(errno))); + } return -1; } @@ -308,9 +328,15 @@ return 0; } + + /* unlock entire db */ static int _tdb_unlockall(struct tdb_context *tdb, int ltype) { + bool mark_lock = ((ltype TDB_MARK_LOCK) == TDB_MARK_LOCK); + + ltype = ~TDB_MARK_LOCK; + /* There are no locks on read-only dbs */ if (tdb-read_only || tdb-traverse_read) { return TDB_ERRCODE(TDB_ERR_LOCK, -1); @@ -325,7 +351,8 @@ return 0; } - if (tdb-methods-tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, + if (!mark_lock + tdb-methods-tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 4*tdb-header.hash_size)) { TDB_LOG((tdb, TDB_DEBUG_ERROR, tdb_unlockall failed (%s)\n, strerror(errno))); return -1; @@ -340,9 +367,27 @@ /* lock entire database with write lock */ int tdb_lockall(struct tdb_context *tdb) { - return _tdb_lockall(tdb, F_WRLCK); + return _tdb_lockall(tdb, F_WRLCK, F_SETLKW); } +/* lock entire database with write lock - mark only */ +int tdb_lockall_mark(struct tdb_context *tdb) +{ + return _tdb_lockall(tdb, F_WRLCK | TDB_MARK_LOCK, F_SETLKW); +} + +/* unlock entire database with write lock - unmark only */ +int tdb_lockall_unmark(struct tdb_context *tdb) +{ + return _tdb_unlockall(tdb, F_WRLCK | TDB_MARK_LOCK); +} + +/* lock entire database with write lock - nonblocking varient */ +int
svn commit: samba r22833 - in branches/SAMBA_4_0/source/torture/local: .
Author: tridge Date: 2007-05-14 01:01:05 + (Mon, 14 May 2007) New Revision: 22833 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22833 Log: use EVENT_FD_AUTOCLOSE in our event test suite Modified: branches/SAMBA_4_0/source/torture/local/event.c Changeset: Modified: branches/SAMBA_4_0/source/torture/local/event.c === --- branches/SAMBA_4_0/source/torture/local/event.c 2007-05-14 01:00:06 UTC (rev 22832) +++ branches/SAMBA_4_0/source/torture/local/event.c 2007-05-14 01:01:05 UTC (rev 22833) @@ -82,7 +82,7 @@ /* create a pipe */ pipe(fd); - fde = event_add_fd(ev_ctx, ev_ctx, fd[0], EVENT_FD_READ, + fde = event_add_fd(ev_ctx, ev_ctx, fd[0], EVENT_FD_READ|EVENT_FD_AUTOCLOSE, fde_handler, fd); event_add_timed(ev_ctx, ev_ctx, timeval_current_ofs(2,0), @@ -105,7 +105,6 @@ } talloc_free(fde); - close(fd[0]); close(fd[1]); while (alarm_count fde_count+1) {
svn commit: samba r22834 - in branches/SAMBA_4_0/source/torture: .
Author: tridge Date: 2007-05-14 01:04:01 + (Mon, 14 May 2007) New Revision: 22834 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22834 Log: fixed a memory leak in the torture_open_connection() code, and removed the duplicate handling of the unclist. This now exposes a function torture_get_conn_index() which can be used by tests to work out which host to talk to using the unclist. I will be using that as part of a set of tests for clustered Samba that need to do auto-reconnect (to allow testing of cluster node failure) Modified: branches/SAMBA_4_0/source/torture/util_smb.c Changeset: Modified: branches/SAMBA_4_0/source/torture/util_smb.c === --- branches/SAMBA_4_0/source/torture/util_smb.c2007-05-14 01:01:05 UTC (rev 22833) +++ branches/SAMBA_4_0/source/torture/util_smb.c2007-05-14 01:04:01 UTC (rev 22834) @@ -486,71 +486,66 @@ return True; } -_PUBLIC_ bool torture_open_connection(struct smbcli_state **c, int conn_index) +_PUBLIC_ bool torture_get_conn_index(int conn_index, +TALLOC_CTX *mem_ctx, +char **host, char **share) { - const char *host = lp_parm_string(-1, torture, host); - const char *share = lp_parm_string(-1, torture, share); char **unc_list = NULL; int num_unc_names = 0; const char *p; + + (*host) = talloc_strdup(mem_ctx, lp_parm_string(-1, torture, host)); + (*share) = talloc_strdup(mem_ctx, lp_parm_string(-1, torture, share)); p = lp_parm_string(-1, torture, unclist); - if (p) { - char *h, *s; - unc_list = file_lines_load(p, num_unc_names, NULL); - if (!unc_list || num_unc_names = 0) { - printf(Failed to load unc names list from '%s'\n, p); - exit(1); - } + if (!p) { + return True; + } - if (!smbcli_parse_unc(unc_list[conn_index % num_unc_names], - NULL, h, s)) { - printf(Failed to parse UNC name %s\n, - unc_list[conn_index % num_unc_names]); - exit(1); - } - host = h; - share = s; + unc_list = file_lines_load(p, num_unc_names, NULL); + if (!unc_list || num_unc_names = 0) { + DEBUG(0,(Failed to load unc names list from '%s'\n, p)); + return False; } - return torture_open_connection_share(NULL, c, host, share, NULL); + if (!smbcli_parse_unc(unc_list[conn_index % num_unc_names], + mem_ctx, host, share)) { + DEBUG(0, (Failed to parse UNC name %s\n, + unc_list[conn_index % num_unc_names])); + return False; + } + + talloc_free(unc_list); + return True; } + + _PUBLIC_ bool torture_open_connection_ev(struct smbcli_state **c, int conn_index, struct event_context *ev) { - const char *host = lp_parm_string(-1, torture, host); - const char *share = lp_parm_string(-1, torture, share); - char **unc_list = NULL; - int num_unc_names = 0; - const char *p; - - p = lp_parm_string(-1, torture, unclist); - if (p) { - char *h, *s; - unc_list = file_lines_load(p, num_unc_names, NULL); - if (!unc_list || num_unc_names = 0) { - printf(Failed to load unc names list from '%s'\n, p); - exit(1); - } + char *host, *share; + bool ret; - if (!smbcli_parse_unc(unc_list[conn_index % num_unc_names], - NULL, h, s)) { - printf(Failed to parse UNC name %s\n, - unc_list[conn_index % num_unc_names]); - exit(1); - } - host = h; - share = s; + if (!torture_get_conn_index(conn_index, ev, host, share)) { + return False; } + ret = torture_open_connection_share(NULL, c, host, share, ev); + talloc_free(host); + talloc_free(share); - return torture_open_connection_share(NULL, c, host, share, ev); + return ret; } +_PUBLIC_ bool torture_open_connection(struct smbcli_state **c, int conn_index) +{ + return torture_open_connection_ev(c, conn_index, NULL); +} + _PUBLIC_ bool torture_close_connection(struct smbcli_state *c) { bool ret = True;
svn commit: samba r22835 - in branches/SAMBA_4_0/source/torture/raw: .
Author: tridge Date: 2007-05-14 01:04:35 + (Mon, 14 May 2007) New Revision: 22835 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22835 Log: it's useful to see how much time is remaining in this test (so we can tell if failures are due to the cleanup code) Modified: branches/SAMBA_4_0/source/torture/raw/openbench.c Changeset: Modified: branches/SAMBA_4_0/source/torture/raw/openbench.c === --- branches/SAMBA_4_0/source/torture/raw/openbench.c 2007-05-14 01:04:01 UTC (rev 22834) +++ branches/SAMBA_4_0/source/torture/raw/openbench.c 2007-05-14 01:04:35 UTC (rev 22835) @@ -207,11 +207,12 @@ goto failed; } - if (loops++ % 1000 != 0) continue; + if (loops++ % 10 != 0) continue; if (torture_setting_bool(torture, progress, true)) { - printf(%.2f ops/second (%d retries)\r, - total/timeval_elapsed(tv), open_retries); + printf(%.2f ops/second (%d retries) (%u remaining)\r, + total/timeval_elapsed(tv), open_retries, + (unsigned)(timelimit - timeval_elapsed(tv))); fflush(stdout); } }
svn commit: samba r22836 - in branches/SAMBA_4_0/source/torture/raw: .
Author: tridge Date: 2007-05-14 01:05:09 + (Mon, 14 May 2007) New Revision: 22836 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22836 Log: started adding auto-reconnect logic to lockbench. This needs to be made async. Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c Changeset: Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c === --- branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-14 01:04:35 UTC (rev 22835) +++ branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-14 01:05:09 UTC (rev 22836) @@ -44,7 +44,9 @@ static int lock_failed; struct benchlock_state { + struct event_context *ev; struct smbcli_state *cli; + int client_num; int fnum; int offset; int count; @@ -77,6 +79,33 @@ } /* + reopen dead connections + */ +static void reopen_connection(struct benchlock_state *state) +{ + do { + DEBUG(0,(reopening connection %u\n, state-client_num)); + } while (!torture_open_connection_ev(state-cli, state-client_num, state-ev)); + + state-fnum = smbcli_open(state-cli-tree, FNAME, O_RDWR|O_CREAT, DENY_NONE); + if (state-fnum == -1) { + printf(Failed to open %s on connection %d\n, FNAME, state-client_num); + exit(1); + } + + state-lock[0].offset = state-offset; + state-io.lockx.in.ulock_cnt = 0; + state-req = smb_raw_lock_send(state-cli-tree, state-io); + if (state-req == NULL) { + DEBUG(0,(Failed to setup lock\n)); + lock_failed++; + } + state-req-async.private = state; + state-req-async.fn = lock_completion; + state-offset = (state-offset+1)%nprocs; +} + +/* called when a lock completes */ static void lock_completion(struct smbcli_request *req) @@ -87,6 +116,9 @@ if (!NT_STATUS_IS_OK(status)) { lock_failed++; DEBUG(0,(Lock failed - %s\n, nt_errstr(status))); + if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { + reopen_connection(state); + } } else { state-count++; lock_send(state); @@ -114,6 +146,8 @@ printf(Opening %d connections\n, nprocs); for (i=0;inprocs;i++) { + state[i].client_num = i; + state[i].ev = ev; if (!torture_open_connection_ev(state[i].cli, i, ev)) { return False; } @@ -171,9 +205,10 @@ for (i=0;inprocs;i++) { total += state[i].count; } - if (torture_setting_bool(torture, progress, true)) { - printf(%.2f ops/second\r, total/timeval_elapsed(tv)); + printf(%.2f ops/second (remaining=%u)\r, + total/timeval_elapsed(tv), + (unsigned)(timelimit - timeval_elapsed(tv))); fflush(stdout); } }
svn commit: samba r22837 - in branches/SAMBA_4_0/source/torture/raw: .
Author: tridge Date: 2007-05-14 03:49:42 + (Mon, 14 May 2007) New Revision: 22837 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22837 Log: make RAW-BENCH-LOCK reconnect asynchronously when one of its servers goges away Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c Changeset: Modified: branches/SAMBA_4_0/source/torture/raw/lockbench.c === --- branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-14 01:05:09 UTC (rev 22836) +++ branches/SAMBA_4_0/source/torture/raw/lockbench.c 2007-05-14 03:49:42 UTC (rev 22837) @@ -29,6 +29,8 @@ #include torture/util.h #include lib/events/events.h #include lib/cmdline/popt_common.h +#include libcli/composite/composite.h +#include libcli/smb_composite/smb_composite.h #define CHECK_STATUS(status, correct) do { \ if (!NT_STATUS_EQUAL(status, correct)) { \ @@ -45,7 +47,8 @@ struct benchlock_state { struct event_context *ev; - struct smbcli_state *cli; + struct smbcli_tree *tree; + TALLOC_CTX *mem_ctx; int client_num; int fnum; int offset; @@ -53,6 +56,13 @@ union smb_lock io; struct smb_lock_entry lock[2]; struct smbcli_request *req; + struct smb_composite_connect reconnect; + + /* these are used for reconnections */ + int dest_port; + const char *dest_host; + const char *called_name; + const char *service_type; }; static void lock_completion(struct smbcli_request *); @@ -64,11 +74,11 @@ { state-io.lockx.in.file.fnum = state-fnum; state-io.lockx.in.ulock_cnt = 1; - state-lock[0].pid = state-cli-session-pid; - state-lock[1].pid = state-cli-session-pid; + state-lock[0].pid = state-tree-session-pid; + state-lock[1].pid = state-tree-session-pid; state-lock[0].offset = state-offset; state-lock[1].offset = (state-offset+1)%nprocs; - state-req = smb_raw_lock_send(state-cli-tree, state-io); + state-req = smb_raw_lock_send(state-tree, state-io); if (state-req == NULL) { DEBUG(0,(Failed to setup lock\n)); lock_failed++; @@ -78,24 +88,26 @@ state-offset = (state-offset+1)%nprocs; } -/* - reopen dead connections - */ -static void reopen_connection(struct benchlock_state *state) +static void reopen_connection(struct benchlock_state *state); + + +static void reopen_file(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private_data) { - do { - DEBUG(0,(reopening connection %u\n, state-client_num)); - } while (!torture_open_connection_ev(state-cli, state-client_num, state-ev)); - - state-fnum = smbcli_open(state-cli-tree, FNAME, O_RDWR|O_CREAT, DENY_NONE); + struct benchlock_state *state = (struct benchlock_state *)private_data; + + /* reestablish our open file */ + state-fnum = smbcli_open(state-tree, FNAME, O_RDWR|O_CREAT, DENY_NONE); if (state-fnum == -1) { printf(Failed to open %s on connection %d\n, FNAME, state-client_num); exit(1); } + /* reestablish one lock, preparing for the async lock loop */ state-lock[0].offset = state-offset; state-io.lockx.in.ulock_cnt = 0; - state-req = smb_raw_lock_send(state-cli-tree, state-io); + state-io.lockx.in.file.fnum = state-fnum; + state-req = smb_raw_lock_send(state-tree, state-io); if (state-req == NULL) { DEBUG(0,(Failed to setup lock\n)); lock_failed++; @@ -106,6 +118,70 @@ } /* + complete an async reconnect + */ +static void reopen_connection_complete(struct composite_context *ctx) +{ + struct benchlock_state *state = (struct benchlock_state *)ctx-async.private_data; + NTSTATUS status; + struct smb_composite_connect *io = state-reconnect; + + status = smb_composite_connect_recv(ctx, state-mem_ctx); + if (!NT_STATUS_IS_OK(status)) { + reopen_connection(state); + return; + } + + talloc_free(state-tree); + state-tree = io-out.tree; + + /* do the reopen as a separate event */ + event_add_timed(state-ev, state-mem_ctx, timeval_zero(), reopen_file, state); +} + + + +/* + reopen dead connections + */ +static void reopen_connection(struct benchlock_state *state) +{ + struct composite_context *ctx; + struct smb_composite_connect *io = state-reconnect; + char *host, *share; + + if (!torture_get_conn_index(state-client_num, state-mem_ctx, host, share)) { + DEBUG(0,(Can't find host/share for reconnect?!\n)); + exit(1); + } + + io-in.dest_host= state-dest_host; + io-in.port = state-dest_port; + io-in.called_name = state-called_name
Rev 295: don't allow setrecmaster while not frozen in http://samba.org/~tridge/ctdb
revno: 295 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Mon 2007-05-14 13:48:14 +1000 message: don't allow setrecmaster while not frozen modified: common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 === modified file 'common/ctdb_control.c' --- a/common/ctdb_control.c 2007-05-12 11:25:26 + +++ b/common/ctdb_control.c 2007-05-14 03:48:14 + @@ -123,8 +123,12 @@ } case CTDB_CONTROL_SET_RECMASTER: { + CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t)); + if (ctdb-freeze_mode != CTDB_FREEZE_FROZEN) { + DEBUG(0,(Attempt to set recmaster when not frozen\n)); + return -1; + } ctdb-recovery_master = ((uint32_t *)(indata.dptr[0]))[0]; - return 0; }
Rev 297: kill the lockwait child if the pipe goes away in http://samba.org/~tridge/ctdb
revno: 297 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Mon 2007-05-14 13:49:01 +1000 message: kill the lockwait child if the pipe goes away modified: common/ctdb_lockwait.c ctdb_lockwait.c-20070416214118-n1aeonljj3vpdd9q-1 === modified file 'common/ctdb_lockwait.c' --- a/common/ctdb_lockwait.c2007-05-05 07:19:59 + +++ b/common/ctdb_lockwait.c2007-05-14 03:49:01 + @@ -131,7 +131,9 @@ close(result-fd[0]); tdb_chainlock(ctdb_db-ltdb-tdb, key); write(result-fd[1], c, 1); - pause(); + /* this read will exit when the parent closes its end + of the pipe, or the parent dies */ + read(result-fd[1], c, 1); _exit(0); }
Rev 296: don't allow setvnnmap while not frozen in http://samba.org/~tridge/ctdb
revno: 296 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Mon 2007-05-14 13:48:40 +1000 message: don't allow setvnnmap while not frozen modified: common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 === modified file 'common/ctdb_recover.c' --- a/common/ctdb_recover.c 2007-05-12 11:25:26 + +++ b/common/ctdb_recover.c 2007-05-14 03:48:40 + @@ -91,6 +91,11 @@ { struct ctdb_vnn_map_wire *map = (struct ctdb_vnn_map_wire *)indata.dptr; + if (ctdb-freeze_mode != CTDB_FREEZE_FROZEN) { + DEBUG(0,(Attempt to set vnnmap when not frozen\n)); + return -1; + } + talloc_free(ctdb-vnn_map); ctdb-vnn_map = talloc(ctdb, struct ctdb_vnn_map);
Rev 298: we must not free the fde until after we no longer need the lock child in http://samba.org/~tridge/ctdb
revno: 298 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Mon 2007-05-14 14:01:33 +1000 message: we must not free the fde until after we no longer need the lock child modified: common/ctdb_lockwait.c ctdb_lockwait.c-20070416214118-n1aeonljj3vpdd9q-1 === modified file 'common/ctdb_lockwait.c' --- a/common/ctdb_lockwait.c2007-05-14 03:49:01 + +++ b/common/ctdb_lockwait.c2007-05-14 04:01:33 + @@ -51,14 +51,17 @@ struct tdb_context *tdb = h-ctdb_db-ltdb-tdb; TALLOC_CTX *tmp_ctx = talloc_new(ev); - talloc_free(fde); - key.dptr = talloc_memdup(tmp_ctx, key.dptr, key.dsize); talloc_set_destructor(h, NULL); ctdb_latency(h-ctdb-status.max_lockwait_latency, h-start_time); h-ctdb-status.pending_lockwait_calls--; + /* the fde needs to go away when the context is gone - when + the fde goes away this implicitly closes the pipe, which + kills the child holding the lock */ + talloc_steal(tmp_ctx, fde); + tdb_chainlock_mark(tdb, key); callback(p); tdb_chainlock_unmark(tdb, key);
Rev 286: added -t option to ctdb_control in http://samba.org/~tridge/ctdb
revno: 286 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 16:04:56 +1000 message: added -t option to ctdb_control modified: tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (227, the limit is 200).
Rev 283: report number of frozen/thawed nodes in http://samba.org/~tridge/ctdb
revno: 283 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 15:44:56 +1000 message: report number of frozen/thawed nodes modified: tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 === modified file 'tools/ctdb_control.c' --- a/tools/ctdb_control.c 2007-05-12 05:15:27 + +++ b/tools/ctdb_control.c 2007-05-12 05:44:56 + @@ -806,7 +806,7 @@ */ static int control_freeze(struct ctdb_context *ctdb, int argc, const char **argv) { - int ret=0; + int ret=0, count=0; uint32_t vnn, i; uint32_t *nodes; uint32_t num_nodes; @@ -830,9 +830,12 @@ int res = ctdb_ctrl_freeze(ctdb, timeval_current_ofs(5, 0), nodes[i]); if (res != 0) { printf(Warning: Unable to freeze node %u\n, nodes[i]); + } else { + count++; } ret |= res; } + printf(Froze %u nodes\n, count); talloc_free(nodes); return 0; } @@ -842,7 +845,7 @@ */ static int control_thaw(struct ctdb_context *ctdb, int argc, const char **argv) { - int ret=0; + int ret=0, count=0; uint32_t vnn, i; uint32_t *nodes; uint32_t num_nodes; @@ -866,9 +869,12 @@ int res = ctdb_ctrl_thaw(ctdb, timeval_current_ofs(5, 0), nodes[i]); if (res != 0) { printf(Warning: Unable to thaw node %u\n, nodes[i]); + } else { + count++; } ret |= res; } + printf(Thawed %u nodes\n, count); talloc_free(nodes); return 0; }
Rev 284: show total frozen/recoving in status in http://samba.org/~tridge/ctdb
revno: 284 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 15:51:08 +1000 message: show total frozen/recoving in status modified: common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 === modified file 'common/ctdb_control.c' --- a/common/ctdb_control.c 2007-05-12 05:15:27 + +++ b/common/ctdb_control.c 2007-05-12 05:51:08 + @@ -71,6 +71,8 @@ CHECK_CONTROL_DATA_SIZE(0); ctdb-status.controls.status++; ctdb-status.memory_used = talloc_total_size(ctdb); + ctdb-status.frozen = (ctdb-freeze_mode == CTDB_FREEZE_FROZEN); + ctdb-status.recovering = (ctdb-recovery_mode == CTDB_RECOVERY_ACTIVE); outdata-dptr = (uint8_t *)ctdb-status; outdata-dsize = sizeof(ctdb-status); return 0; === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2007-05-12 05:15:27 + +++ b/include/ctdb_private.h2007-05-12 05:51:08 + @@ -136,6 +136,8 @@ */ struct ctdb_status { uint32_t num_clients; + uint32_t frozen; + uint32_t recovering; uint32_t client_packets_sent; uint32_t client_packets_recv; uint32_t node_packets_sent; === modified file 'tools/ctdb_control.c' --- a/tools/ctdb_control.c 2007-05-12 05:44:56 + +++ b/tools/ctdb_control.c 2007-05-12 05:51:08 + @@ -102,6 +102,8 @@ } fields[] = { #define STATUS_FIELD(n) { #n, offsetof(struct ctdb_status, n) } STATUS_FIELD(num_clients), + STATUS_FIELD(frozen), + STATUS_FIELD(recovering), STATUS_FIELD(client_packets_sent), STATUS_FIELD(client_packets_recv), STATUS_FIELD(node_packets_sent),
Rev 285: - nicer message if freeze child dies in http://samba.org/~tridge/ctdb
revno: 285 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 15:59:49 +1000 message: - nicer message if freeze child dies - change local generation count after recovery/freeze started modified: common/ctdb_freeze.c ctdb_freeze.c-20070512051503-935zdtyuqknqnhmo-1 direct/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 === modified file 'common/ctdb_freeze.c' --- a/common/ctdb_freeze.c 2007-05-12 05:44:35 + +++ b/common/ctdb_freeze.c 2007-05-12 05:59:49 + @@ -82,6 +82,12 @@ int32_t status; struct ctdb_freeze_waiter *w; + if (h-ctdb-freeze_mode == CTDB_FREEZE_FROZEN) { + DEBUG(0,(freeze child died - unfreezing\n)); + talloc_free(h); + return; + } + if (read(h-fd, status, sizeof(status)) != sizeof(status)) { DEBUG(0,(read error from freeze lock child\n)); status = -1; === modified file 'direct/ctdb_recoverd.c' --- a/direct/ctdb_recoverd.c2007-05-12 05:15:27 + +++ b/direct/ctdb_recoverd.c2007-05-12 05:59:49 + @@ -330,6 +330,13 @@ DEBUG(0, (__location__ Recovery initiated\n)); + /* set recovery mode to active on all nodes */ + ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE); + if (ret!=0) { + DEBUG(0, (__location__ Unable to set recovery mode to active on cluster\n)); + return -1; + } + /* pick a new generation number */ generation = random(); @@ -350,15 +357,6 @@ return -1; } - - /* set recovery mode to active on all nodes */ - ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE); - if (ret!=0) { - DEBUG(0, (__location__ Unable to set recovery mode to active on cluster\n)); - return -1; - } - - /* get a list of all databases */ ret = ctdb_ctrl_getdbmap(ctdb, timeval_current_ofs(1, 0), vnn, mem_ctx, dbmap); if (ret != 0) {
Rev 282: watch for the freeze child exiting in http://samba.org/~tridge/ctdb
revno: 282 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 15:44:35 +1000 message: watch for the freeze child exiting modified: common/ctdb_freeze.c ctdb_freeze.c-20070512051503-935zdtyuqknqnhmo-1 === modified file 'common/ctdb_freeze.c' --- a/common/ctdb_freeze.c 2007-05-12 05:29:06 + +++ b/common/ctdb_freeze.c 2007-05-12 05:44:35 + @@ -102,8 +102,6 @@ DLIST_REMOVE(h-ctdb-freeze_handle-waiters, w); talloc_free(w); } - - talloc_free(fde); } /*
svn commit: samba r22813 - in branches/SAMBA_4_0/source/torture/raw: .
Author: tridge Date: 2007-05-12 07:44:09 + (Sat, 12 May 2007) New Revision: 22813 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22813 Log: improve error messages in RAW-NOTIFY test Modified: branches/SAMBA_4_0/source/torture/raw/notify.c Changeset: Modified: branches/SAMBA_4_0/source/torture/raw/notify.c === --- branches/SAMBA_4_0/source/torture/raw/notify.c 2007-05-12 01:08:09 UTC (rev 22812) +++ branches/SAMBA_4_0/source/torture/raw/notify.c 2007-05-12 07:44:09 UTC (rev 22813) @@ -489,14 +489,27 @@ ((expected) FILE_NOTIFY_CHANGE_ATTRIBUTES) \ Action == NOTIFY_ACTION_OLD_NAME) { \ printf((rename file special handling OK)\n); \ - } else if (nchanges != notify.nttrans.out.num_changes || \ - notify.nttrans.out.changes[0].action != Action || \ - strcmp(notify.nttrans.out.changes[0].name.s, tname1) != 0) { \ - printf(ERROR: nchanges=%d action=%d filter=0x%08x\n, \ + } else if (nchanges != notify.nttrans.out.num_changes) { \ + printf(ERROR: nchanges=%d expected=%d action=%d filter=0x%08x\n, \ notify.nttrans.out.num_changes, \ + nchanges, \ notify.nttrans.out.changes[0].action, \ notify.nttrans.in.completion_filter); \ ret = False; \ + } else if (notify.nttrans.out.changes[0].action != Action) { \ + printf(ERROR: nchanges=%d action=%d expectedAction=%d filter=0x%08x\n, \ + notify.nttrans.out.num_changes, \ + notify.nttrans.out.changes[0].action, \ + Action, \ + notify.nttrans.in.completion_filter); \ + ret = False; \ + } else if (strcmp(notify.nttrans.out.changes[0].name.s, tname1) != 0) { \ + printf(ERROR: nchanges=%d action=%d filter=0x%08x name=%s\n, \ + notify.nttrans.out.num_changes, \ + notify.nttrans.out.changes[0].action, \ + notify.nttrans.in.completion_filter, \ + notify.nttrans.out.changes[0].name.s); \ + ret = False; \ } \ mask |= (1i); \ } \
Rev 287: make sure we ignore requeued ctdb_call packets of older generations except for packets from the client in http://samba.org/~tridge/ctdb
revno: 287 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 18:08:50 +1000 message: make sure we ignore requeued ctdb_call packets of older generations except for packets from the client modified: common/ctdb_call.c ctdb_call.c-20061128065342-to93h6eejj5kon81-1 common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2 common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 === modified file 'common/ctdb_call.c' --- a/common/ctdb_call.c2007-05-11 00:33:43 + +++ b/common/ctdb_call.c2007-05-12 08:08:50 + @@ -363,7 +363,7 @@ /* fetch the current record */ ret = ctdb_ltdb_lock_fetch_requeue(ctdb_db, key, header, hdr, data2, - ctdb_recv_raw_pkt, ctdb); + ctdb_recv_raw_pkt, ctdb, False); if (ret == -1) { ctdb_fatal(ctdb, ctdb_req_dmaster failed to fetch record); return; @@ -433,7 +433,7 @@ if the call will be answered locally */ ret = ctdb_ltdb_lock_fetch_requeue(ctdb_db, call.key, header, hdr, data, - ctdb_recv_raw_pkt, ctdb); + ctdb_recv_raw_pkt, ctdb, False); if (ret == -1) { ctdb_send_error(ctdb, hdr, ret, ltdb fetch failed in ctdb_request_call); return; @@ -556,7 +556,7 @@ data.dsize = c-datalen; ret = ctdb_ltdb_lock_requeue(ctdb_db, key, hdr, -ctdb_recv_raw_pkt, ctdb); +ctdb_recv_raw_pkt, ctdb, False); if (ret == -2) { return; } === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-12 04:34:21 + +++ b/common/ctdb_daemon.c 2007-05-12 08:08:50 + @@ -413,7 +413,7 @@ ret = ctdb_ltdb_lock_fetch_requeue(ctdb_db, key, header, (struct ctdb_req_header *)c, data, - daemon_incoming_packet, client); + daemon_incoming_packet, client, True); if (ret == -2) { /* will retry later */ ctdb-status.pending_calls--; === modified file 'common/ctdb_ltdb.c' --- a/common/ctdb_ltdb.c2007-05-11 00:33:43 + +++ b/common/ctdb_ltdb.c2007-05-12 08:08:50 + @@ -195,6 +195,8 @@ void (*recv_pkt)(void *, uint8_t *, uint32_t); void *recv_context; struct ctdb_req_header *hdr; + uint32_t generation; + bool ignore_generation; }; /* @@ -203,6 +205,12 @@ static void lock_fetch_callback(void *p) { struct lock_fetch_state *state = talloc_get_type(p, struct lock_fetch_state); + if (!state-ignore_generation + state-generation != state-ctdb-vnn_map-generation) { + DEBUG(0,(Discarding previous generation lockwait packet\n)); + talloc_free(state-hdr); + return; + } state-recv_pkt(state-recv_context, (uint8_t *)state-hdr, state-hdr-length); DEBUG(2,(__location__ PACKET REQUEUED\n)); } @@ -235,7 +243,7 @@ int ctdb_ltdb_lock_requeue(struct ctdb_db_context *ctdb_db, TDB_DATA key, struct ctdb_req_header *hdr, void (*recv_pkt)(void *, uint8_t *, uint32_t ), - void *recv_context) + void *recv_context, bool ignore_generation) { int ret; struct tdb_context *tdb = ctdb_db-ltdb-tdb; @@ -267,6 +275,8 @@ state-hdr = hdr; state-recv_pkt = recv_pkt; state-recv_context = recv_context; + state-generation = ctdb_db-ctdb-vnn_map-generation; + state-ignore_generation = ignore_generation; /* now the contended path */ h = ctdb_lockwait(ctdb_db, key, lock_fetch_callback, state); @@ -291,11 +301,12 @@ TDB_DATA key, struct ctdb_ltdb_header *header, struct ctdb_req_header *hdr, TDB_DATA *data, void (*recv_pkt)(void *, uint8_t *, uint32_t ), -void *recv_context) +void *recv_context, bool ignore_generation) { int ret; - ret = ctdb_ltdb_lock_requeue(ctdb_db, key, hdr, recv_pkt, recv_context); + ret = ctdb_ltdb_lock_requeue(ctdb_db, key, hdr, recv_pkt, +recv_context, ignore_generation); if (ret == 0
Rev 290: the retry client code is no longer needed now that we use a freeze on recovery in http://samba.org/~tridge/ctdb
revno: 290 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 19:55:55 +1000 message: the retry client code is no longer needed now that we use a freeze on recovery modified: common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-12 08:08:50 + +++ b/common/ctdb_daemon.c 2007-05-12 09:55:55 + @@ -334,31 +334,10 @@ } -struct ctdb_client_retry { - struct ctdb_client *client; - struct ctdb_req_call *call; -}; - static void daemon_request_call_from_client(struct ctdb_client *client, struct ctdb_req_call *c); /* - triggered after a one second delay, retrying a client packet - that was deferred because of the daemon being in recovery mode - */ -static void retry_client_packet(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private_data) -{ - struct ctdb_client_retry *retry = talloc_get_type(private_data, struct ctdb_client_retry); - - daemon_request_call_from_client(retry-client, retry-call); - - talloc_free(retry); -} - - - -/* this is called when the ctdb daemon received a ctdb request call from a local client over the unix domain socket */ @@ -374,29 +353,6 @@ int ret; struct ctdb_context *ctdb = client-ctdb; - if (ctdb-recovery_mode != CTDB_RECOVERY_NORMAL) { - struct ctdb_client_retry *retry; - - DEBUG(0,(__location__ ctdb call %u from client - while we are in recovery mode. Deferring it\n, -c-hdr.reqid)); - - /* hang the event and the structure off client */ - retry = talloc(client, struct ctdb_client_retry); - CTDB_NO_MEMORY_VOID(ctdb, retry); - retry-client = client; - retry-call = c; - - /* this ensures that after the retry happens we - eventually free this request */ - talloc_steal(retry, c); - - event_add_timed(ctdb-ev, retry, timeval_current_ofs(1,0), retry_client_packet, retry); - return; - } - - - ctdb-status.total_calls++; ctdb-status.pending_calls++;
Rev 291: the invalid dmaster is no longer needed in recovery in http://samba.org/~tridge/ctdb
revno: 291 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 19:56:31 +1000 message: the invalid dmaster is no longer needed in recovery modified: direct/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 === modified file 'direct/ctdb_recoverd.c' --- a/direct/ctdb_recoverd.c2007-05-12 05:59:49 + +++ b/direct/ctdb_recoverd.c2007-05-12 09:56:31 + @@ -392,18 +392,6 @@ } - - /* repoint all local and remote database records to an invalid - node as being dmaster to stop the shortcut from working -*/ - ret = update_dmaster_on_all_databases(ctdb, nodemap, 0x, dbmap, mem_ctx); - if (ret != 0) { - DEBUG(0, (__location__ Unable to update dmaster on all databases\n)); - return -1; - } - - - /* pull all remote databases onto the local node */ ret = pull_all_remote_databases(ctdb, nodemap, vnn, dbmap, mem_ctx); if (ret != 0) {
Rev 288: simplify the generation checking on incoming call packets in http://samba.org/~tridge/ctdb
revno: 288 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 19:54:40 +1000 message: simplify the generation checking on incoming call packets modified: common/ctdb.c ctdb.c-20061127094323-t50f58d65iaao5of-2 === modified file 'common/ctdb.c' --- a/common/ctdb.c 2007-05-09 22:13:19 + +++ b/common/ctdb.c 2007-05-12 09:54:40 + @@ -261,8 +261,12 @@ switch (hdr-operation) { case CTDB_REQ_CALL: - /* verify that the remote node that sent us the call - is running in the same generation instance as this node + case CTDB_REPLY_CALL: + case CTDB_REQ_DMASTER: + case CTDB_REPLY_DMASTER: + /* for ctdb_call inter-node operations verify that the + remote node that sent us the call is running in the + same generation instance as this node */ if (ctdb-vnn_map-generation != hdr-generation) { DEBUG(0,(__location__ ctdb request %d @@ -273,20 +277,12 @@ hdr-srcnode, hdr-destnode, ctdb-vnn_map-generation, hdr-generation)); - break; - } - /* if we are in recovery mode we discard all traffic - until the cluster has recovered. - */ - if (ctdb-recovery_mode != CTDB_RECOVERY_NORMAL) { - DEBUG(0,(__location__ ctdb request %d -length %d from node %d to %d -while we are in recovery mode\n, - hdr-reqid, hdr-length, -hdr-srcnode, hdr-destnode)); - break; - } + goto done; + } + } + switch (hdr-operation) { + case CTDB_REQ_CALL: ctdb-status.node.req_call++; ctdb_request_call(ctdb, hdr); break; @@ -302,63 +298,11 @@ break; case CTDB_REQ_DMASTER: - /* verify that the remote node that sent us dmaster req - is running in the same generation instance as this node - */ - if (ctdb-vnn_map-generation != hdr-generation) { - DEBUG(0,(__location__ ctdb dmaster request %d -length %d from node %d to %d had an -invalid generation id:%d while our -generation id is:%d\n, - hdr-reqid, hdr-length, - hdr-srcnode, hdr-destnode, - ctdb-vnn_map-generation, - hdr-generation)); - break; - } - /* if we are in recovery mode we discard all traffic - until the cluster has recovered. - */ - if (ctdb-recovery_mode != CTDB_RECOVERY_NORMAL) { - DEBUG(0,(__location__ ctdb dmaster request %d -length %d from node %d to %d -while we are in recovery mode\n, - hdr-reqid, hdr-length, -hdr-srcnode, hdr-destnode)); - break; - } - ctdb-status.node.req_dmaster++; ctdb_request_dmaster(ctdb, hdr); break; case CTDB_REPLY_DMASTER: - /* verify that the remote node that sent us dmaster reply - is running in the same generation instance as this node - */ - if (ctdb-vnn_map-generation != hdr-generation) { - DEBUG(0,(__location__ ctdb dmaster reply %d -length %d from node %d to %d had an -invalid generation id:%d while our -generation id is:%d\n, - hdr-reqid, hdr-length, - hdr-srcnode, hdr-destnode, - ctdb-vnn_map-generation, - hdr-generation)); - break; - } - /* if we are in recovery mode we discard all traffic - until the cluster has recovered. - */ - if (ctdb-recovery_mode != CTDB_RECOVERY_NORMAL) { - DEBUG(0,(__location__ ctdb dmaster reply %d -length %d from node %d to %d -while we are in recovery mode\n
Rev 289: ensure we propogate the correct rsn for a request dmaster in http://samba.org/~tridge/ctdb
revno: 289 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 19:55:18 +1000 message: ensure we propogate the correct rsn for a request dmaster modified: common/ctdb_call.c ctdb_call.c-20061128065342-to93h6eejj5kon81-1 === modified file 'common/ctdb_call.c' --- a/common/ctdb_call.c2007-05-12 08:08:50 + +++ b/common/ctdb_call.c2007-05-12 09:55:18 + @@ -390,6 +390,9 @@ return; } + /* use the rsn from the sending node */ + header.rsn = c-rsn; + /* check if the new dmaster is the lmaster, in which case we skip the dmaster reply */ if (c-dmaster == ctdb-vnn) { @@ -649,6 +652,7 @@ state-c-hdr.destnode = ctdb-vnn; ctdb_queue_packet(ctdb, state-c-hdr); + DEBUG(0,(requeued ctdb_call after timeout\n)); } /*
Rev 292: prioritise the dmaster in case of matching rsn in http://samba.org/~tridge/ctdb
revno: 292 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 19:57:12 +1000 message: prioritise the dmaster in case of matching rsn modified: common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 === modified file 'common/ctdb_recover.c' --- a/common/ctdb_recover.c 2007-05-12 08:08:50 + +++ b/common/ctdb_recover.c 2007-05-12 09:57:12 + @@ -225,6 +225,7 @@ params.ctdb = ctdb; params.lmaster = pull-lmaster; + params.rec_count = 0; params.recs = talloc_array(outdata, struct getkeys_rec, 0); CTDB_NO_MEMORY(ctdb, params.recs); @@ -318,9 +319,10 @@ DEBUG(0, (__location__ Unable to fetch record\n)); goto failed; } - /* the = is to cope with just-created records, which - have a rsn of zero */ - if (header.rsn = hdr-rsn) { + /* The check for dmaster gives priority to the dmaster + if the rsn values are equal */ + if (header.rsn hdr-rsn || + (header.dmaster != ctdb-vnn header.rsn == hdr-rsn)) { ret = ctdb_ltdb_store(ctdb_db, key, hdr, data); if (ret != 0) { DEBUG(0, (__location__ Unable to store record\n));
Rev 293: added error messages in ctdb_control replies in http://samba.org/~tridge/ctdb
revno: 293 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 21:25:26 +1000 message: added error messages in ctdb_control replies modified: common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 common/ctdb_freeze.c ctdb_freeze.c-20070512051503-935zdtyuqknqnhmo-1 common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (611, the limit is 200).
Rev 294: make sure the ctdb control socket is secure in http://samba.org/~tridge/ctdb
revno: 294 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sun 2007-05-13 09:20:16 +1000 message: make sure the ctdb control socket is secure modified: common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-12 11:25:26 + +++ b/common/ctdb_daemon.c 2007-05-12 23:20:16 + @@ -600,10 +600,15 @@ ctdb-daemon.sd = socket(AF_UNIX, SOCK_STREAM, 0); if (ctdb-daemon.sd == -1) { - ctdb-daemon.sd = -1; return -1; } + if (fchown(ctdb-daemon.sd, geteuid(), getegid()) != 0 || + fchmod(ctdb-daemon.sd, 0700) != 0) { + DEBUG(0,(Unable to secure ctdb socket '%s', ctdb-daemon.name\n)); + goto failed; + } + set_non_blocking(ctdb-daemon.sd); memset(addr, 0, sizeof(addr)); @@ -611,13 +616,20 @@ strncpy(addr.sun_path, ctdb-daemon.name, sizeof(addr.sun_path)); if (bind(ctdb-daemon.sd, (struct sockaddr *)addr, sizeof(addr)) == -1) { - close(ctdb-daemon.sd); - ctdb-daemon.sd = -1; - return -1; + DEBUG(0,(Unable to bind on ctdb socket '%s', ctdb-daemon.name\n)); + goto failed; } - listen(ctdb-daemon.sd, 1); + if (listen(ctdb-daemon.sd, 10) != 0) { + DEBUG(0,(Unable to listen on ctdb socket '%s', ctdb-daemon.name\n)); + goto failed; + } return 0; + +failed: + close(ctdb-daemon.sd); + ctdb-daemon.sd = -1; + return -1; } /*
svn commit: samba r22784 - in branches/SAMBA_3_0/source/smbd: .
Author: tridge Date: 2007-05-11 07:22:10 + (Fri, 11 May 2007) New Revision: 22784 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22784 Log: fixed change notify for delete on close Modified: branches/SAMBA_3_0/source/smbd/close.c Changeset: Modified: branches/SAMBA_3_0/source/smbd/close.c === --- branches/SAMBA_3_0/source/smbd/close.c 2007-05-10 22:20:22 UTC (rev 22783) +++ branches/SAMBA_3_0/source/smbd/close.c 2007-05-11 07:22:10 UTC (rev 22784) @@ -287,6 +287,10 @@ status = map_nt_error_from_unix(errno); } + notify_fname(conn, NOTIFY_ACTION_REMOVED, +FILE_NOTIFY_CHANGE_FILE_NAME, +fsp-fsp_name); + /* As we now have POSIX opens which can unlink * with other open files we may have taken * this code path with more than one share mode
Rev 277: fixed debug message in http://samba.org/~tridge/ctdb
revno: 277 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Fri 2007-05-11 17:29:21 +1000 message: fixed debug message modified: common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 === modified file 'common/ctdb_client.c' --- a/common/ctdb_client.c 2007-05-10 19:40:11 + +++ b/common/ctdb_client.c 2007-05-11 07:29:21 + @@ -891,7 +891,7 @@ CTDB_CONTROL_SET_RECMODE, 0, data, ctdb, outdata, res, timeout); if (ret != 0 || res != 0) { - DEBUG(0,(__location__ ctdb_control for getrecmode failed\n)); + DEBUG(0,(__location__ ctdb_control for setrecmode failed\n)); return -1; }
Rev 280: separate out the freeze/thaw handling from recovery in http://samba.org/~tridge/ctdb
revno: 280 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 15:15:27 +1000 message: separate out the freeze/thaw handling from recovery added: common/ctdb_freeze.c ctdb_freeze.c-20070512051503-935zdtyuqknqnhmo-1 modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 direct/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (857, the limit is 200).
Rev 279: added lockwait child code for entering recovery mode. A child processes holds lockall locks for the entire recovery process in http://samba.org/~tridge/ctdb
revno: 279 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 14:34:21 +1000 message: added lockwait child code for entering recovery mode. A child processes holds lockall locks for the entire recovery process modified: common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 direct/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 Diff too large for email (876, the limit is 200).
Rev 278: added _mark calls for tdb_lockall in http://samba.org/~tridge/ctdb
revno: 278 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 14:33:10 +1000 message: added _mark calls for tdb_lockall modified: lib/tdb/common/lock.c lock.c-20070220022425-m1wibgjq7n5hahs6-7 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 === modified file 'lib/tdb/common/lock.c' --- a/lib/tdb/common/lock.c 2007-05-10 07:43:08 + +++ b/lib/tdb/common/lock.c 2007-05-12 04:33:10 + @@ -290,6 +290,10 @@ /* lock/unlock entire database */ static int _tdb_lockall(struct tdb_context *tdb, int ltype, int op) { + bool mark_lock = ((ltype TDB_MARK_LOCK) == TDB_MARK_LOCK); + + ltype = ~TDB_MARK_LOCK; + /* There are no locks on read-only dbs */ if (tdb-read_only || tdb-traverse_read) return TDB_ERRCODE(TDB_ERR_LOCK, -1); @@ -309,7 +313,8 @@ return TDB_ERRCODE(TDB_ERR_LOCK, -1); } - if (tdb-methods-tdb_brlock(tdb, FREELIST_TOP, ltype, op, + if (!mark_lock + tdb-methods-tdb_brlock(tdb, FREELIST_TOP, ltype, op, 0, 4*tdb-header.hash_size)) { if (op == F_SETLKW) { TDB_LOG((tdb, TDB_DEBUG_ERROR, tdb_lockall failed (%s)\n, strerror(errno))); @@ -328,6 +333,10 @@ /* unlock entire db */ static int _tdb_unlockall(struct tdb_context *tdb, int ltype) { + bool mark_lock = ((ltype TDB_MARK_LOCK) == TDB_MARK_LOCK); + + ltype = ~TDB_MARK_LOCK; + /* There are no locks on read-only dbs */ if (tdb-read_only || tdb-traverse_read) { return TDB_ERRCODE(TDB_ERR_LOCK, -1); @@ -342,7 +351,8 @@ return 0; } - if (tdb-methods-tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, + if (!mark_lock + tdb-methods-tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 4*tdb-header.hash_size)) { TDB_LOG((tdb, TDB_DEBUG_ERROR, tdb_unlockall failed (%s)\n, strerror(errno))); return -1; @@ -360,6 +370,18 @@ return _tdb_lockall(tdb, F_WRLCK, F_SETLKW); } +/* lock entire database with write lock - mark only */ +int tdb_lockall_mark(struct tdb_context *tdb) +{ + return _tdb_lockall(tdb, F_WRLCK | TDB_MARK_LOCK, F_SETLKW); +} + +/* unlock entire database with write lock - unmark only */ +int tdb_lockall_unmark(struct tdb_context *tdb) +{ + return _tdb_unlockall(tdb, F_WRLCK | TDB_MARK_LOCK); +} + /* lock entire database with write lock - nonblocking varient */ int tdb_lockall_nonblock(struct tdb_context *tdb) { === modified file 'lib/tdb/include/tdb.h' --- a/lib/tdb/include/tdb.h 2007-05-10 07:43:08 + +++ b/lib/tdb/include/tdb.h 2007-05-12 04:33:10 + @@ -121,6 +121,8 @@ int tdb_lockall_read(struct tdb_context *tdb); int tdb_lockall_read_nonblock(struct tdb_context *tdb); int tdb_unlockall_read(struct tdb_context *tdb); +int tdb_lockall_mark(struct tdb_context *tdb); +int tdb_lockall_unmark(struct tdb_context *tdb); const char *tdb_name(struct tdb_context *tdb); int tdb_fd(struct tdb_context *tdb); tdb_log_func tdb_log_fn(struct tdb_context *tdb);
Rev 281: more robust freeze/thaw logic in http://samba.org/~tridge/ctdb
revno: 281 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-12 15:29:06 +1000 message: more robust freeze/thaw logic modified: common/ctdb_freeze.c ctdb_freeze.c-20070512051503-935zdtyuqknqnhmo-1 common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 Diff too large for email (283, the limit is 200).
Rev 271: setup the random number generator a bit better in http://samba.org/~tridge/ctdb
revno: 271 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-10 13:10:23 +1000 message: setup the random number generator a bit better modified: direct/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 === modified file 'direct/ctdb_recoverd.c' --- a/direct/ctdb_recoverd.c2007-05-09 22:49:57 + +++ b/direct/ctdb_recoverd.c2007-05-10 03:10:23 + @@ -508,12 +508,11 @@ struct election_message *em = (struct election_message *)data.dptr; TALLOC_CTX *mem_ctx; - mem_ctx = talloc_new(ctdb); - if (em-vnn==ctdb_get_vnn(ctdb)) { - talloc_free(mem_ctx); return; } + + mem_ctx = talloc_new(ctdb); /* someone called an election. check their election data and if we disagree and we would rather be the elected node, @@ -628,13 +627,12 @@ goto again; } - /* verify that the recmaster node is still active */ for (j=0; jnodemap-num; j++) { if (nodemap-nodes[j].vnn==recmaster) { break; } - } + } if (!(nodemap-nodes[j].flagsNODE_FLAGS_CONNECTED)) { DEBUG(0, (Recmaster node %u no longer available. Force reelection\n, nodemap-nodes[j].vnn)); force_election(ctdb, mem_ctx, vnn, nodemap); @@ -736,7 +734,7 @@ /* there better be the same number of lmasters in the vnn map - as there are active nodes or well have to do a recovery + as there are active nodes or we will have to do a recovery */ if (vnnmap-size != num_active) { DEBUG(0, (__location__ The vnnmap count is different from the number of active nodes. %d vs %d\n, vnnmap-size, num_active)); @@ -856,6 +854,8 @@ } #endif + srandom(getpid() ^ time(NULL)); + ev = event_context_init(NULL); /* initialise ctdb */
Rev 272: merge from ronnie in http://samba.org/~tridge/ctdb
revno: 272 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-10 13:15:58 +1000 message: merge from ronnie modified: direct/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 197.1.97 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-10 10:10:58 +1000 message: create a correct vnnmap structure to prevent a segv revno: 197.1.96 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-10 10:03:21 +1000 message: update ctdb_control to create a correct ctdb_vnn_map-map array revno: 197.1.95 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-10 09:48:14 +1000 message: when starting a new election, also force all nodes into recovery mode so there is no internode traffic to interfere with our election revno: 197.1.94 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-10 09:46:10 +1000 message: when starting recovery repoint dmaster to an invalid node and not the current vnn revno: 197.1.93 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-10 09:44:28 +1000 message: merge from tridge revno: 197.1.92 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-10 09:43:01 +1000 message: actually check the remote nodes and not just the local node revno: 197.1.91 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-10 06:55:28 +1000 message: merge from tridge === modified file 'direct/ctdb_recoverd.c' --- a/direct/ctdb_recoverd.c2007-05-10 03:10:23 + +++ b/direct/ctdb_recoverd.c2007-05-10 03:15:58 + @@ -381,7 +381,7 @@ /* repoint all local and remote database records to an invalid node as being dmaster to stop the shortcut from working */ - ret = update_dmaster_on_all_databases(ctdb, nodemap, vnn, dbmap, mem_ctx); + ret = update_dmaster_on_all_databases(ctdb, nodemap, 0x, dbmap, mem_ctx); if (ret != 0) { DEBUG(0, (__location__ Unable to update dmaster on all databases\n)); return -1; @@ -546,6 +546,13 @@ static void force_election(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, uint32_t vnn, struct ctdb_node_map *nodemap) { int ret; + + /* set all nodes to recovery mode to stop all internode traffic */ + ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE); + if (ret!=0) { + DEBUG(0, (__location__ Unable to set recovery mode to active on cluster\n)); + return; + } ret = send_election_request(ctdb, mem_ctx, vnn); if (ret!=0) { @@ -657,7 +664,7 @@ continue; } - ret = ctdb_ctrl_getrecmaster(ctdb, timeval_current_ofs(1, 0), vnn, recmaster); + ret = ctdb_ctrl_getrecmaster(ctdb, timeval_current_ofs(1, 0), nodemap-nodes[j].vnn, recmaster); if (ret != 0) { DEBUG(0, (__location__ Unable to get recmaster from node %u\n, vnn)); goto again; @@ -679,7 +686,7 @@ continue; } - ret = ctdb_ctrl_getrecmode(ctdb, timeval_current_ofs(1, 0), vnn, recmode); + ret = ctdb_ctrl_getrecmode(ctdb, timeval_current_ofs(1, 0), nodemap-nodes[j].vnn, recmode); if (ret != 0) { DEBUG(0, (Unable to get
Rev 273: better timeout handling for calls, controls and traverses in http://samba.org/~tridge/ctdb
revno: 273 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-10 14:06:48 +1000 message: better timeout handling for calls, controls and traverses modified: common/ctdb_call.c ctdb_call.c-20061128065342-to93h6eejj5kon81-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_traverse.c ctdb_traverse.c-20070503021550-ztfs5rwx8jfm8qqx-1 direct/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (241, the limit is 200).
Rev 275: - got rid of the complex hand marshalling in the recovery controls in http://samba.org/~tridge/ctdb
revno: 275 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-10 17:43:45 +1000 message: - got rid of the complex hand marshalling in the recovery controls - fixed the re-send of ctdb calls after a generation change - fixed a reqid idr leak in controls - removed the write_record test code - use the new nonblock lockall code to prevent ctdbd from ever doing a blocking lock that could deadlock with smbd - moved more of the recovery controls into ctdb_recover.c modified: common/ctdb_call.c ctdb_call.c-20061128065342-to93h6eejj5kon81-1 common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2 common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 common/ctdb_traverse.c ctdb_traverse.c-20070503021550-ztfs5rwx8jfm8qqx-1 common/ctdb_util.c ctdb_util.c-20061128065342-to93h6eejj5kon81-3 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (1011, the limit is 200).
Rev 274: added nonblocking varients of the two lockall functions to tdb in http://samba.org/~tridge/ctdb
revno: 274 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-10 17:43:08 +1000 message: added nonblocking varients of the two lockall functions to tdb modified: lib/tdb/common/lock.c lock.c-20070220022425-m1wibgjq7n5hahs6-7 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 === modified file 'lib/tdb/common/lock.c' --- a/lib/tdb/common/lock.c 2007-05-05 07:14:33 + +++ b/lib/tdb/common/lock.c 2007-05-10 07:43:08 + @@ -288,7 +288,7 @@ /* lock/unlock entire database */ -static int _tdb_lockall(struct tdb_context *tdb, int ltype) +static int _tdb_lockall(struct tdb_context *tdb, int ltype, int op) { /* There are no locks on read-only dbs */ if (tdb-read_only || tdb-traverse_read) @@ -309,9 +309,11 @@ return TDB_ERRCODE(TDB_ERR_LOCK, -1); } - if (tdb-methods-tdb_brlock(tdb, FREELIST_TOP, ltype, F_SETLKW, + if (tdb-methods-tdb_brlock(tdb, FREELIST_TOP, ltype, op, 0, 4*tdb-header.hash_size)) { - TDB_LOG((tdb, TDB_DEBUG_ERROR, tdb_lockall failed (%s)\n, strerror(errno))); + if (op == F_SETLKW) { + TDB_LOG((tdb, TDB_DEBUG_ERROR, tdb_lockall failed (%s)\n, strerror(errno))); + } return -1; } @@ -321,6 +323,8 @@ return 0; } + + /* unlock entire db */ static int _tdb_unlockall(struct tdb_context *tdb, int ltype) { @@ -353,7 +357,13 @@ /* lock entire database with write lock */ int tdb_lockall(struct tdb_context *tdb) { - return _tdb_lockall(tdb, F_WRLCK); + return _tdb_lockall(tdb, F_WRLCK, F_SETLKW); +} + +/* lock entire database with write lock - nonblocking varient */ +int tdb_lockall_nonblock(struct tdb_context *tdb) +{ + return _tdb_lockall(tdb, F_WRLCK, F_SETLK); } /* unlock entire database with write lock */ @@ -365,7 +375,13 @@ /* lock entire database with read lock */ int tdb_lockall_read(struct tdb_context *tdb) { - return _tdb_lockall(tdb, F_RDLCK); + return _tdb_lockall(tdb, F_RDLCK, F_SETLKW); +} + +/* lock entire database with read lock - nonblock varient */ +int tdb_lockall_read_nonblock(struct tdb_context *tdb) +{ + return _tdb_lockall(tdb, F_RDLCK, F_SETLK); } /* unlock entire database with read lock */ === modified file 'lib/tdb/include/tdb.h' --- a/lib/tdb/include/tdb.h 2007-05-05 07:14:33 + +++ b/lib/tdb/include/tdb.h 2007-05-10 07:43:08 + @@ -116,8 +116,10 @@ int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *); int tdb_exists(struct tdb_context *tdb, TDB_DATA key); int tdb_lockall(struct tdb_context *tdb); +int tdb_lockall_nonblock(struct tdb_context *tdb); int tdb_unlockall(struct tdb_context *tdb); int tdb_lockall_read(struct tdb_context *tdb); +int tdb_lockall_read_nonblock(struct tdb_context *tdb); int tdb_unlockall_read(struct tdb_context *tdb); const char *tdb_name(struct tdb_context *tdb); int tdb_fd(struct tdb_context *tdb);
Rev 276: - merge from ronnie in http://samba.org/~tridge/ctdb
revno: 276 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Fri 2007-05-11 10:33:43 +1000 message: - merge from ronnie - increment rsn only in become_dmaster - add torture check for rsn regression in ctdb_ltdb_store modified: common/ctdb_call.c ctdb_call.c-20061128065342-to93h6eejj5kon81-1 common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2 revno: 197.1.100 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-11 06:08:17 +1000 message: we must bump the rsn everytime we do a REQ_DMASTER or a REPLY_DMASTER to make sure that the merge records based on rsn during recovery will merge correctly. this is extra important since samba3 never bumps the record when it writes new data to it ! revno: 197.1.99 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-11 05:40:11 +1000 message: make ctdb_control catdb work again revno: 197.1.98 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-10 17:59:51 +1000 message: merge from tridge === modified file 'common/ctdb_call.c' --- a/common/ctdb_call.c2007-05-10 07:43:45 + +++ b/common/ctdb_call.c2007-05-11 00:33:43 + @@ -295,7 +295,7 @@ DEBUG(2,(vnn %u dmaster response %08x\n, ctdb-vnn, ctdb_hash(key))); ZERO_STRUCT(header); - header.rsn = rsn; + header.rsn = rsn + 1; header.dmaster = ctdb-vnn; if (ctdb_ltdb_store(ctdb_db, key, header, data) != 0) { === modified file 'common/ctdb_client.c' --- a/common/ctdb_client.c 2007-05-10 07:43:45 + +++ b/common/ctdb_client.c 2007-05-10 19:40:11 + @@ -1037,17 +1037,16 @@ { int i, ret; TDB_DATA indata, outdata; + struct ctdb_control_pulldb pull; + struct ctdb_control_pulldb_reply *reply; + struct ctdb_rec_data *rec; int32_t res; - unsigned char *ptr; - - DEBUG(0,(ronnie to fix!\n)); - return -1; - - indata.dsize = 2*sizeof(uint32_t); - indata.dptr = (unsigned char *)talloc_array(mem_ctx, uint32_t, 2); - - ((uint32_t *)(indata.dptr[0]))[0] = dbid; - ((uint32_t *)(indata.dptr[0]))[1] = lmaster; + + pull.db_id = dbid; + pull.lmaster = lmaster; + + indata.dsize = sizeof(struct ctdb_control_pulldb); + indata.dptr = (unsigned char *)pull; ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_PULL_DB, 0, indata, @@ -1058,45 +1057,34 @@ } - keys-dbid = ((uint32_t *)(outdata.dptr[0]))[0]; - keys-num= ((uint32_t *)(outdata.dptr[0]))[1]; - keys-keys =talloc_array(mem_ctx, TDB_DATA, keys-num); - keys-headers=talloc_array(mem_ctx, struct ctdb_ltdb_header, keys-num); - keys-lmasters=talloc_array(mem_ctx, uint32_t, keys-num); - keys-data=talloc_array(mem_ctx, TDB_DATA, keys-num); - - /* loop over all key/data pairs */ - ptr=outdata.dptr[8]; - for(i=0;ikeys-num;i++){ - TDB_DATA *key, *data; - - keys-lmasters[i] = *((uint32_t *)ptr); - ptr += 4; - - key = keys-keys[i]; - key-dsize = *((uint32_t *)ptr); - key-dptr = talloc_size(mem_ctx, key-dsize); - ptr += 4; - - data = keys-data[i]; - data-dsize = *((uint32_t *)ptr); - data-dptr = talloc_size(mem_ctx, data-dsize); - ptr += 4; - - ptr = outdata.dptr+(((ptr-outdata.dptr)+CTDB_DS_ALIGNMENT-1) ~(CTDB_DS_ALIGNMENT-1)); - memcpy(key-dptr, ptr, key-dsize); - ptr += key-dsize; - - ptr = outdata.dptr+(((ptr-outdata.dptr)+CTDB_DS_ALIGNMENT-1) ~(CTDB_DS_ALIGNMENT-1)); - memcpy(keys-headers[i], ptr, sizeof(struct ctdb_ltdb_header)); - ptr += sizeof(struct ctdb_ltdb_header); - - ptr = outdata.dptr+(((ptr-outdata.dptr)+CTDB_DS_ALIGNMENT-1) ~(CTDB_DS_ALIGNMENT-1)); - memcpy(data-dptr, ptr, data-dsize); - ptr += data-dsize; - - ptr = outdata.dptr+(((ptr-outdata.dptr)+CTDB_DS_ALIGNMENT-1) ~(CTDB_DS_ALIGNMENT-1
Rev 266: merged ronnies code to delay client requests when in recovery mode in http://samba.org/~tridge/ctdb
revno: 266 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-10 07:43:18 +1000 message: merged ronnies code to delay client requests when in recovery mode modified: common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 revno: 197.1.90 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-09 14:08:11 +1000 message: hang the event from the retry structure instead of the hdr structure revno: 197.1.89 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-09 14:06:47 +1000 message: when we are in recovery mode and we get a REQ_CALL from a client, defer it for one second and try again === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-08 23:59:23 + +++ b/common/ctdb_daemon.c 2007-05-09 21:43:18 + @@ -334,6 +334,30 @@ } +struct ctdb_client_retry { + struct ctdb_client *client; + struct ctdb_req_call *call; +}; + +static void daemon_request_call_from_client(struct ctdb_client *client, + struct ctdb_req_call *c); + +/* + triggered after a one second delay, retrying a client packet + that was deferred because of the daemon being in recovery mode + */ +static void retry_client_packet(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private_data) +{ + struct ctdb_client_retry *retry = talloc_get_type(private_data, struct ctdb_client_retry); + + daemon_request_call_from_client(retry-client, retry-call); + + talloc_free(retry); +} + + + /* this is called when the ctdb daemon received a ctdb request call from a local client over the unix domain socket @@ -350,6 +374,29 @@ int ret; struct ctdb_context *ctdb = client-ctdb; + if (ctdb-recovery_mode != CTDB_RECOVERY_NORMAL) { + struct ctdb_client_retry *retry; + + DEBUG(0,(__location__ ctdb call %u from client + while we are in recovery mode. Deferring it\n, +c-hdr.reqid)); + + /* hang the event and the structure off client */ + retry = talloc(client, struct ctdb_client_retry); + CTDB_NO_MEMORY_VOID(ctdb, retry); + retry-client = client; + retry-call = c; + + /* this ensures that after the retry happens we + eventually free this request */ + talloc_steal(retry, c); + + event_add_timed(ctdb-ev, retry, timeval_current_ofs(1,0), retry_client_packet, retry); + return; + } + + + ctdb-status.total_calls++; ctdb-status.pending_calls++;
Rev 270: remove old s3 recovery code in http://samba.org/~tridge/ctdb
revno: 270 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-10 08:49:57 +1000 message: remove old s3 recovery code fixed vnnmap wire format in recover daemon modified: direct/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 tools/monitor_recovery.sh monitor_recovery.sh-20070508220533-oy7s689rcjsu7yte-1 Diff too large for email (254, the limit is 200).
Rev 267: moved the vnn_map initialisation out of the cmdline code in http://samba.org/~tridge/ctdb
revno: 267 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-10 07:55:46 +1000 message: moved the vnn_map initialisation out of the cmdline code modified: common/cmdline.c cmdline.c-20070416041216-w1zvz91bkdsgjckw-1 common/ctdb.c ctdb.c-20061127094323-t50f58d65iaao5of-2 common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 === modified file 'common/cmdline.c' --- a/common/cmdline.c 2007-05-08 23:59:23 + +++ b/common/cmdline.c 2007-05-09 21:55:46 + @@ -89,7 +89,7 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev) { struct ctdb_context *ctdb; - int i, ret; + int ret; if (ctdb_cmdline.nlist == NULL) { printf(You must provide a node list with --nlist\n); @@ -156,26 +156,6 @@ } } - /* initialize the vnn mapping table */ -/* -XXX we currently initialize it to the maximum number of nodes to -XXX make it behave the same way as previously. -XXX Once we have recovery working we should initialize this always to -XXX generation==0 (==invalid) and let the recovery tool populate this -XXX table for the daemons. -*/ - ctdb-vnn_map = talloc_zero_size(ctdb, offsetof(struct ctdb_vnn_map, map) + 4*ctdb-num_nodes); - if (ctdb-vnn_map == NULL) { - DEBUG(0,(__location__ Unable to allocate vnn_map structure\n)); - exit(1); - } - ctdb-vnn_map-generation = 1; - ctdb-vnn_map-size = ctdb-num_nodes; - for(i=0;ictdb-vnn_map-size;i++){ - ctdb-vnn_map-map[i] = i%ctdb-num_nodes; - } - - return ctdb; } === modified file 'common/ctdb.c' --- a/common/ctdb.c 2007-05-06 19:02:48 + +++ b/common/ctdb.c 2007-05-09 21:55:46 + @@ -152,6 +152,25 @@ return -1; } } + + /* initialize the vnn mapping table now that we have num_nodes setup */ +/* +XXX we currently initialize it to the maximum number of nodes to +XXX make it behave the same way as previously. +XXX Once we have recovery working we should initialize this always to +XXX generation==0 (==invalid) and let the recovery tool populate this +XXX table for the daemons. +*/ + ctdb-vnn_map = talloc_zero_size(ctdb, offsetof(struct ctdb_vnn_map, map) + 4*ctdb-num_nodes); + if (ctdb-vnn_map == NULL) { + DEBUG(0,(__location__ Unable to allocate vnn_map structure\n)); + exit(1); + } + ctdb-vnn_map-generation = 1; + ctdb-vnn_map-size = ctdb-num_nodes; + for(i=0;ictdb-vnn_map-size;i++){ + ctdb-vnn_map-map[i] = i%ctdb-num_nodes; + } talloc_free(lines); return 0; === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-09 21:43:18 + +++ b/common/ctdb_daemon.c 2007-05-09 21:55:46 + @@ -721,7 +721,6 @@ close(fd[1]); - ctdb-ev = event_context_init(NULL); fde = event_add_fd(ctdb-ev, ctdb, fd[0], EVENT_FD_READ|EVENT_FD_AUTOCLOSE, ctdb_read_from_parent, fd[0]); fde = event_add_fd(ctdb-ev, ctdb, ctdb-daemon.sd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE, ctdb_accept_client, ctdb);
Rev 269: fixed setvnnmap to use wire structures too in http://samba.org/~tridge/ctdb
revno: 269 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-10 08:22:26 +1000 message: fixed setvnnmap to use wire structures too modified: common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 === modified file 'common/ctdb_client.c' --- a/common/ctdb_client.c 2007-05-09 22:13:19 + +++ b/common/ctdb_client.c 2007-05-09 22:22:26 + @@ -990,9 +990,19 @@ int ret; TDB_DATA data, outdata; int32_t res; - - data.dsize = offsetof(struct ctdb_vnn_map, map) + 4*vnnmap-size; - data.dptr = (unsigned char *)vnnmap; + struct ctdb_vnn_map_wire *map; + size_t len; + + len = offsetof(struct ctdb_vnn_map_wire, map) + sizeof(uint32_t)*vnnmap-size; + map = talloc_size(mem_ctx, len); + CTDB_NO_MEMORY_VOID(ctdb, map); + + map-generation = vnnmap-generation; + map-size = vnnmap-size; + memcpy(map-map, vnnmap-map, sizeof(uint32_t)*map-size); + + data.dsize = len; + data.dptr = (uint8_t *)map; ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_SETVNNMAP, 0, data, @@ -1002,6 +1012,8 @@ return -1; } + talloc_free(map); + return 0; } === modified file 'common/ctdb_recover.c' --- a/common/ctdb_recover.c 2007-05-09 22:13:19 + +++ b/common/ctdb_recover.c 2007-05-09 22:22:26 + @@ -52,12 +52,19 @@ int ctdb_control_setvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata) { - if (ctdb-vnn_map) { - talloc_free(ctdb-vnn_map); - ctdb-vnn_map = NULL; - } - - ctdb-vnn_map = (struct ctdb_vnn_map *)talloc_memdup(ctdb, indata.dptr, indata.dsize); + struct ctdb_vnn_map_wire *map = (struct ctdb_vnn_map_wire *)indata.dptr; + + talloc_free(ctdb-vnn_map); + + ctdb-vnn_map = talloc(ctdb, struct ctdb_vnn_map); + CTDB_NO_MEMORY(ctdb, ctdb-vnn_map); + + ctdb-vnn_map-generation = map-generation; + ctdb-vnn_map-size = map-size; + ctdb-vnn_map-map = talloc_array(ctdb-vnn_map, uint32_t, map-size); + CTDB_NO_MEMORY(ctdb, ctdb-vnn_map-map); + + memcpy(ctdb-vnn_map-map, map-map, sizeof(uint32_t)*map-size); return 0; }
Rev 268: separate the wire format and internal format for the vnn_map in http://samba.org/~tridge/ctdb
revno: 268 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-10 08:13:19 +1000 message: separate the wire format and internal format for the vnn_map modified: common/ctdb.c ctdb.c-20061127094323-t50f58d65iaao5of-2 common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tests/ctdbd.sh ctdbd.sh-20070411085038-phusiewluwzyqjpc-2 === modified file 'common/ctdb.c' --- a/common/ctdb.c 2007-05-09 21:55:46 + +++ b/common/ctdb.c 2007-05-09 22:13:19 + @@ -161,15 +161,16 @@ XXX generation==0 (==invalid) and let the recovery tool populate this XXX table for the daemons. */ - ctdb-vnn_map = talloc_zero_size(ctdb, offsetof(struct ctdb_vnn_map, map) + 4*ctdb-num_nodes); - if (ctdb-vnn_map == NULL) { - DEBUG(0,(__location__ Unable to allocate vnn_map structure\n)); - exit(1); - } + ctdb-vnn_map = talloc(ctdb, struct ctdb_vnn_map); + CTDB_NO_MEMORY(ctdb, ctdb-vnn_map); + ctdb-vnn_map-generation = 1; ctdb-vnn_map-size = ctdb-num_nodes; - for(i=0;ictdb-vnn_map-size;i++){ - ctdb-vnn_map-map[i] = i%ctdb-num_nodes; + ctdb-vnn_map-map = talloc_array(ctdb-vnn_map, uint32_t, ctdb-vnn_map-size); + CTDB_NO_MEMORY(ctdb, ctdb-vnn_map-map); + + for(i=0;ictdb-vnn_map-size;i++) { + ctdb-vnn_map-map[i] = i; } talloc_free(lines); === modified file 'common/ctdb_client.c' --- a/common/ctdb_client.c 2007-05-06 21:54:17 + +++ b/common/ctdb_client.c 2007-05-09 22:13:19 + @@ -808,6 +808,7 @@ int ret; TDB_DATA data, outdata; int32_t res; + struct ctdb_vnn_map_wire *map; ZERO_STRUCT(data); ret = ctdb_control(ctdb, destnode, 0, @@ -817,8 +818,22 @@ DEBUG(0,(__location__ ctdb_control for getvnnmap failed\n)); return -1; } - - *vnnmap = (struct ctdb_vnn_map *)talloc_memdup(mem_ctx, outdata.dptr, outdata.dsize); + + map = (struct ctdb_vnn_map_wire *)outdata.dptr; + if (outdata.dsize offsetof(struct ctdb_vnn_map_wire, map) || + outdata.dsize != map-size*sizeof(uint32_t) + offsetof(struct ctdb_vnn_map_wire, map)) { + DEBUG(0,(Bad vnn map size received in ctdb_ctrl_getvnnmap\n)); + return -1; + } + + (*vnnmap) = talloc(mem_ctx, struct ctdb_vnn_map); + CTDB_NO_MEMORY(ctdb, *vnnmap); + (*vnnmap)-generation = map-generation; + (*vnnmap)-size = map-size; + (*vnnmap)-map= talloc_array(*vnnmap, uint32_t, map-size); + + CTDB_NO_MEMORY(ctdb, (*vnnmap)-map); + memcpy((*vnnmap)-map, map-map, sizeof(uint32_t)*map-size); return 0; } === modified file 'common/ctdb_recover.c' --- a/common/ctdb_recover.c 2007-05-03 06:18:03 + +++ b/common/ctdb_recover.c 2007-05-09 22:13:19 + @@ -32,9 +32,19 @@ ctdb_control_getvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata) { CHECK_CONTROL_DATA_SIZE(0); - - outdata-dsize = offsetof(struct ctdb_vnn_map, map) + 4*ctdb-vnn_map-size; - outdata-dptr = (unsigned char *)ctdb-vnn_map; + struct ctdb_vnn_map_wire *map; + size_t len; + + len = offsetof(struct ctdb_vnn_map_wire, map) + sizeof(uint32_t)*ctdb-vnn_map-size; + map = talloc_size(outdata, len); + CTDB_NO_MEMORY_VOID(ctdb, map); + + map-generation = ctdb-vnn_map-generation; + map-size = ctdb-vnn_map-size; + memcpy(map-map, ctdb-vnn_map-map, sizeof(uint32_t)*map-size); + + outdata-dsize = len; + outdata-dptr = (uint8_t *)map; return 0; } === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2007-05-08 11:16:29 + +++ b/include/ctdb_private.h2007-05-09 22:13:19 + @@ -192,6 +192,15 @@ struct ctdb_vnn_map { uint32_t generation; uint32_t size; + uint32_t *map; +}; + +/* + a wire representation of the vnn map + */ +struct ctdb_vnn_map_wire { + uint32_t generation; + uint32_t size; uint32_t map[1]; }; === modified file 'tests/ctdbd.sh' --- a/tests/ctdbd.sh2007-05-04 02:18:39 + +++ b/tests/ctdbd.sh2007-05-09 22:13:19 + @@ -31,4 +31,6 @@ echo Testing getdbmap $VALGRIND bin/ctdb_control getdbmap 0 || exit 1 +echo All done + killall -q ctdbd
Rev 264: fixed a problem with the number of timed events growing without bound with the new seqnum code in http://samba.org/~tridge/ctdb
revno: 264 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Tue 2007-05-08 21:16:29 +1000 message: fixed a problem with the number of timed events growing without bound with the new seqnum code modified: common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 === modified file 'common/ctdb_ltdb.c' --- a/common/ctdb_ltdb.c2007-05-05 07:35:28 + +++ b/common/ctdb_ltdb.c2007-05-08 11:16:29 + @@ -440,8 +440,9 @@ ctdb_db-seqnum = new_seqnum; /* setup a new timer */ - event_add_timed(ctdb-ev, ctdb_db, timeval_current_ofs(ctdb-seqnum_frequency, 0), - ctdb_ltdb_seqnum_check, ctdb_db); + ctdb_db-te = event_add_timed(ctdb-ev, ctdb_db, + timeval_current_ofs(ctdb-seqnum_frequency, 0), + ctdb_ltdb_seqnum_check, ctdb_db); } /* @@ -456,8 +457,11 @@ return -1; } - event_add_timed(ctdb-ev, ctdb_db, timeval_current_ofs(ctdb-seqnum_frequency, 0), - ctdb_ltdb_seqnum_check, ctdb_db); + if (ctdb_db-te == NULL) { + ctdb_db-te = event_add_timed(ctdb-ev, ctdb_db, + timeval_current_ofs(ctdb-seqnum_frequency, 0), + ctdb_ltdb_seqnum_check, ctdb_db); + } tdb_enable_seqnum(ctdb_db-ltdb-tdb); ctdb_db-seqnum = tdb_get_seqnum(ctdb_db-ltdb-tdb); === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2007-05-06 19:02:48 + +++ b/include/ctdb_private.h2007-05-08 11:16:29 + @@ -246,6 +246,7 @@ struct tdb_wrap *ltdb; struct ctdb_registered_call *calls; /* list of registered calls */ uint32_t seqnum; + struct timed_event *te; };
Rev 265: merge from ronnie in http://samba.org/~tridge/ctdb
revno: 265 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Wed 2007-05-09 11:54:37 +1000 message: merge from ronnie added: tools/monitor_recovery.sh monitor_recovery.sh-20070508220533-oy7s689rcjsu7yte-1 renamed: direct/recoverd.c = direct/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 common/cmdline.c cmdline.c-20070416041216-w1zvz91bkdsgjckw-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 tests/recover.sh recover.sh-20070502031230-tpuiet6m6tjdotta-1 direct/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 revno: 197.1.88 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-09 09:59:23 +1000 message: add a command line flag to ctdbd to start a recovery daemon. update the recovery test script to start all ctdb daemons with a recovery daemon revno: 197.1.87 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-09 09:31:53 +1000 message: change the name of the recovery daemon to ctdb_recoverd revno: 197.1.86 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-09 08:05:53 +1000 message: add a small tool to monitor recovery revno: 197.1.85 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Tue 2007-05-08 14:51:55 +1000 message: we must repoint dmaster to an invalid node during recovery to stop the shortcut from working revno: 197.1.84 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Tue 2007-05-08 14:42:00 +1000 message: fix alignment bug for pulldb revno: 197.1.83 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Mon 2007-05-07 08:07:26 +1000 message: merge from tridge Diff too large for email (217, the limit is 200).
Rev 263: merged from ronnie in http://samba.org/~tridge/ctdb
revno: 263 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Mon 2007-05-07 07:56:38 +1000 message: merged from ronnie modified: common/ctdb.c ctdb.c-20061127094323-t50f58d65iaao5of-2 common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 direct/recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tests/recover.sh recover.sh-20070502031230-tpuiet6m6tjdotta-1 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 197.1.82 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Mon 2007-05-07 07:54:17 +1000 message: hang the timeout event off state and thus we dont need to explicitely free it and also we wont accidentally return from the function without killing the event first revno: 197.1.81 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Mon 2007-05-07 07:47:16 +1000 message: it now works to talloc_free() the timed event if we no longer want it to trigger this must have been a sideeffect of a different bug in the recoverd.c code that has now been fixed revno: 197.1.80 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Mon 2007-05-07 06:51:58 +1000 message: recovery daemon with recovery master election election is primitive, it elects the lowest vnn as the recovery master two new controls, to get/set recovery master for a node to use recovery daemon, start one ./bin/recoverd --socket=ctdb.socket* for each ctdb daemon it has been briefly tested by deleting and adding nodes to a 4 node cluster but needs more testing revno: 197.1.79 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Mon 2007-05-07 05:02:48 +1000 message: add new controls to get and set the recovery master node of a daemon i.e. which node is elected to check for and drive recovery revno: 197.1.78 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Mon 2007-05-07 04:41:12 +1000 message: add a test in the function that checks whether the cluster needs recovery or not that all active nodes are in normal mode. If we discover that some node is still in recoverymode it may indicate that a previous recovery ended prematurely and thus we should start a new recovery revno: 197.1.77 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Sun 2007-05-06 12:46:56 +1000 message: update a comment to be more desciptive revno: 197.1.76 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Sun 2007-05-06 10:51:25 +1000 message: change a lot of printf into debug statements revno: 197.1.75 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Sun 2007-05-06 10:42:18 +1000 message: break out the code to update all nodes to the new vnnmap into a helper function revno: 197.1.74 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Sun 2007-05-06 10:38:44 +1000 message: create a helper function for recovery to push all local databases out
Rev 259: allow the events system to be chosen on the command line in http://samba.org/~tridge/ctdb
revno: 259 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 17:18:43 +1000 message: allow the events system to be chosen on the command line modified: common/cmdline.c cmdline.c-20070416041216-w1zvz91bkdsgjckw-1 === modified file 'common/cmdline.c' --- a/common/cmdline.c 2007-05-03 01:06:24 + +++ b/common/cmdline.c 2007-05-05 07:18:43 + @@ -37,6 +37,7 @@ const char *db_dir; int torture; const char *logfile; + const char *events; } ctdb_cmdline = { .nlist = NULL, .transport = tcp, @@ -45,11 +46,26 @@ .self_connect = 0, .db_dir = NULL, .torture = 0, - .logfile = NULL + .logfile = NULL, }; +enum {OPT_EVENTSYSTEM=1}; + +static void ctdb_cmdline_callback(poptContext con, + enum poptCallbackReason reason, + const struct poptOption *opt, + const char *arg, const void *data) +{ + switch (opt-val) { + case OPT_EVENTSYSTEM: + event_set_default_backend(arg); + break; + } +} + struct poptOption popt_ctdb_cmdline[] = { + { NULL, 0, POPT_ARG_CALLBACK, (void *)ctdb_cmdline_callback }, { nlist, 0, POPT_ARG_STRING, ctdb_cmdline.nlist, 0, node list file, filename }, { listen, 0, POPT_ARG_STRING, ctdb_cmdline.myaddress, 0, address to listen on, address }, { socket, 0, POPT_ARG_STRING, ctdb_cmdline.socketname, 0, local socket name, filename }, @@ -59,6 +75,7 @@ { dbdir, 0, POPT_ARG_STRING, ctdb_cmdline.db_dir, 0, directory for the tdb files, NULL }, { torture, 0, POPT_ARG_NONE, ctdb_cmdline.torture, 0, enable nastiness in library, NULL }, { logfile, 0, POPT_ARG_STRING, ctdb_cmdline.logfile, 0, log file location, filename }, + { events, 0, POPT_ARG_STRING, NULL, OPT_EVENTSYSTEM, event system, NULL }, { NULL } };
Rev 260: - take advantage of the new EVENT_FD_AUTOCLOSE flag in http://samba.org/~tridge/ctdb
revno: 260 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 17:19:59 +1000 message: - take advantage of the new EVENT_FD_AUTOCLOSE flag - use the tdb_chainlock_mark() call to allow us to guarantee forward progress in the ctdb_lockwait code modified: common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 common/ctdb_io.c ctdb_io.c-20070409200335-dzfc7f3rra5rcf60-1 common/ctdb_lockwait.c ctdb_lockwait.c-20070416214118-n1aeonljj3vpdd9q-1 common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2 common/ctdb_traverse.c ctdb_traverse.c-20070503021550-ztfs5rwx8jfm8qqx-1 === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-05 04:09:46 + +++ b/common/ctdb_daemon.c 2007-05-05 07:19:59 + @@ -249,8 +249,6 @@ { ctdb_reqid_remove(client-ctdb, client-client_id); client-ctdb-status.num_clients--; - close(client-fd); - client-fd = -1; return 0; } @@ -678,8 +676,8 @@ ctdb-ev = event_context_init(NULL); - fde = event_add_fd(ctdb-ev, ctdb, fd[0], EVENT_FD_READ, ctdb_read_from_parent, fd[0]); - fde = event_add_fd(ctdb-ev, ctdb, ctdb-daemon.sd, EVENT_FD_READ, ctdb_accept_client, ctdb); + fde = event_add_fd(ctdb-ev, ctdb, fd[0], EVENT_FD_READ|EVENT_FD_AUTOCLOSE, ctdb_read_from_parent, fd[0]); + fde = event_add_fd(ctdb-ev, ctdb, ctdb-daemon.sd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE, ctdb_accept_client, ctdb); ctdb_main_loop(ctdb); return 0; @@ -720,7 +718,7 @@ talloc_set_destructor(domain_socket_name, unlink_destructor); ctdb-ev = event_context_init(NULL); - fde = event_add_fd(ctdb-ev, ctdb, ctdb-daemon.sd, EVENT_FD_READ, + fde = event_add_fd(ctdb-ev, ctdb, ctdb-daemon.sd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE, ctdb_accept_client, ctdb); ctdb_main_loop(ctdb); === modified file 'common/ctdb_io.c' --- a/common/ctdb_io.c 2007-05-03 02:16:03 + +++ b/common/ctdb_io.c 2007-05-05 07:19:59 + @@ -273,7 +273,7 @@ queue-fde = NULL; if (fd != -1) { - queue-fde = event_add_fd(queue-ctdb-ev, queue, fd, EVENT_FD_READ, + queue-fde = event_add_fd(queue-ctdb-ev, queue, fd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE, queue_io_handler, queue); if (queue-fde == NULL) { return -1; === modified file 'common/ctdb_lockwait.c' --- a/common/ctdb_lockwait.c2007-04-23 21:33:37 + +++ b/common/ctdb_lockwait.c2007-05-05 07:19:59 + @@ -29,11 +29,13 @@ struct lockwait_handle { struct ctdb_context *ctdb; + struct ctdb_db_context *ctdb_db; struct fd_event *fde; int fd[2]; pid_t child; void *private_data; void (*callback)(void *); + TDB_DATA key; struct timeval start_time; }; @@ -45,19 +47,30 @@ void (*callback)(void *) = h-callback; void *p = h-private_data; pid_t child = h-child; + TDB_DATA key = h-key; + struct tdb_context *tdb = h-ctdb_db-ltdb-tdb; + TALLOC_CTX *tmp_ctx = talloc_new(ev); + + talloc_free(fde); + + key.dptr = talloc_memdup(tmp_ctx, key.dptr, key.dsize); + talloc_set_destructor(h, NULL); - close(h-fd[0]); ctdb_latency(h-ctdb-status.max_lockwait_latency, h-start_time); h-ctdb-status.pending_lockwait_calls--; - talloc_free(h); + + tdb_chainlock_mark(tdb, key); callback(p); + tdb_chainlock_unmark(tdb, key); + + kill(child, SIGKILL); waitpid(child, NULL, 0); + talloc_free(tmp_ctx); } static int lockwait_destructor(struct lockwait_handle *h) { h-ctdb-status.pending_lockwait_calls--; - close(h-fd[0]); kill(h-child, SIGKILL); waitpid(h-child, NULL, 0); return 0; @@ -84,7 +97,7 @@ ctdb_db-ctdb-status.lockwait_calls++; ctdb_db-ctdb-status.pending_lockwait_calls++; - if (!(result = talloc_zero(ctdb_db, struct lockwait_handle))) { + if (!(result = talloc_zero(private_data, struct lockwait_handle))) { ctdb_db-ctdb-status.pending_lockwait_calls--; return NULL; } @@ -110,13 +123,15 @@ result-callback = callback; result-private_data = private_data; result-ctdb = ctdb_db-ctdb; + result-ctdb_db = ctdb_db; + result-key = key; if (result-child == 0) { + char c = 0; close(result-fd[0]); - /* -* Do we need a tdb_reopen here? -*/ tdb_chainlock(ctdb_db-ltdb-tdb, key); + write(result-fd[1], c, 1); + pause
Rev 256: added tdb_chainlock_mark() call, which can be used to mark a chain locked without actually locking it. This will be used to guarantee forward progress in the ctdb non-blocking lockwait code i
revno: 256 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 17:14:33 +1000 message: added tdb_chainlock_mark() call, which can be used to mark a chain locked without actually locking it. This will be used to guarantee forward progress in the ctdb non-blocking lockwait code modified: lib/tdb/common/lock.c lock.c-20070220022425-m1wibgjq7n5hahs6-7 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 === modified file 'lib/tdb/common/lock.c' --- a/lib/tdb/common/lock.c 2007-04-16 13:03:36 + +++ b/lib/tdb/common/lock.c 2007-05-05 07:14:33 + @@ -28,6 +28,8 @@ #include tdb_private.h +#define TDB_MARK_LOCK 0x8000 + /* a byte range locking function - return 0 on success this functions locks/unlocks 1 byte at the specified offset. @@ -109,6 +111,9 @@ { struct tdb_lock_type *new_lck; int i; + bool mark_lock = ((ltype TDB_MARK_LOCK) == TDB_MARK_LOCK); + + ltype = ~TDB_MARK_LOCK; /* a global lock allows us to avoid per chain locks */ if (tdb-global_lock.count @@ -158,7 +163,8 @@ /* Since fcntl locks don't nest, we do a lock for the first one, and simply bump the count for future ones */ - if (tdb-methods-tdb_brlock(tdb,FREELIST_TOP+4*list,ltype, op, + if (!mark_lock + tdb-methods-tdb_brlock(tdb,FREELIST_TOP+4*list, ltype, op, 0, 1)) { return -1; } @@ -200,6 +206,9 @@ int ret = -1; int i; struct tdb_lock_type *lck = NULL; + bool mark_lock = ((ltype TDB_MARK_LOCK) == TDB_MARK_LOCK); + + ltype = ~TDB_MARK_LOCK; /* a global lock allows us to avoid per chain locks */ if (tdb-global_lock.count @@ -244,8 +253,12 @@ * anyway. */ - ret = tdb-methods-tdb_brlock(tdb, FREELIST_TOP+4*list, F_UNLCK, - F_SETLKW, 0, 1); + if (mark_lock) { + ret = 0; + } else { + ret = tdb-methods-tdb_brlock(tdb, FREELIST_TOP+4*list, F_UNLCK, + F_SETLKW, 0, 1); + } tdb-num_locks--; /* @@ -376,6 +389,18 @@ return tdb_lock_nonblock(tdb, BUCKET(tdb-hash_fn(key)), F_WRLCK); } +/* mark a chain as locked without actually locking it. Warning! use with great caution! */ +int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key) +{ + return tdb_lock(tdb, BUCKET(tdb-hash_fn(key)), F_WRLCK | TDB_MARK_LOCK); +} + +/* unmark a chain as locked without actually locking it. Warning! use with great caution! */ +int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key) +{ + return tdb_unlock(tdb, BUCKET(tdb-hash_fn(key)), F_WRLCK | TDB_MARK_LOCK); +} + int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key) { return tdb_unlock(tdb, BUCKET(tdb-hash_fn(key)), F_WRLCK); === modified file 'lib/tdb/include/tdb.h' --- a/lib/tdb/include/tdb.h 2007-05-04 12:18:00 + +++ b/lib/tdb/include/tdb.h 2007-05-05 07:14:33 + @@ -140,6 +140,8 @@ int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key); int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key); int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key); +int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key); +int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key); /* Debug functions. Not used in production. */ void tdb_dump_all(struct tdb_context *tdb);
Rev 258: use the new lib/events autoconf code in http://samba.org/~tridge/ctdb
revno: 258 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 17:18:06 +1000 message: use the new lib/events autoconf code modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 autogen.sh autogen.sh-20061117234101-o3qt14umlg9en8z0-3 configure.ac configure.ac-20061117234101-o3qt14umlg9en8z0-10 === modified file 'Makefile.in' --- a/Makefile.in 2007-05-03 22:30:18 + +++ b/Makefile.in 2007-05-05 07:18:06 + @@ -23,9 +23,6 @@ [EMAIL PROTECTED]@ -Llib @LIBS@ $(POPT_LIBS) @INFINIBAND_LIBS@ -EVENTS_OBJ = lib/events/events.o lib/events/events_standard.o \ - lib/events/events_signal.o lib/events/events_timed.o - UTIL_OBJ = lib/util/idtree.o lib/util/db_wrap.o lib/util/strlist.o lib/util/util.o CTDB_COMMON_OBJ = common/ctdb.o common/ctdb_daemon.o common/ctdb_client.o \ @@ -38,7 +35,7 @@ CTDB_OBJ = $(CTDB_COMMON_OBJ) $(CTDB_TCP_OBJ) $(POPT_OBJ) -OBJS = @TDB_OBJ@ @TALLOC_OBJ@ @LIBREPLACEOBJ@ @INFINIBAND_WRAPPER_OBJ@ $(EXTRA_OBJ) $(EVENTS_OBJ) $(CTDB_OBJ) $(UTIL_OBJ) +OBJS = @TDB_OBJ@ @TALLOC_OBJ@ @LIBREPLACEOBJ@ @INFINIBAND_WRAPPER_OBJ@ $(EXTRA_OBJ) @EVENTS_OBJ@ $(CTDB_OBJ) $(UTIL_OBJ) BINS = bin/ctdbd bin/ctdbd_test bin/ctdb_test bin/ctdb_bench bin/ctdb_messaging bin/ctdb_fetch bin/ctdb_fetch1 bin/lockwait bin/ctdb_control bin/ctdb_dump bin/recoverd @INFINIBAND_BINS@ === modified file 'autogen.sh' --- a/autogen.sh2006-11-17 23:41:20 + +++ b/autogen.sh2007-05-05 07:18:06 + @@ -7,6 +7,8 @@ IPATHS=$IPATHS -I lib/talloc -I talloc -I ../talloc IPATHS=$IPATHS -I lib/tdb -I tdb -I ../tdb IPATHS=$IPATHS -I lib/popt -I popt -I ../popt +IPATHS=$IPATHS -I lib/events + autoheader $IPATHS || exit 1 autoconf $IPATHS || exit 1 === modified file 'configure.ac' --- a/configure.ac 2007-05-02 19:21:14 + +++ b/configure.ac 2007-05-05 07:18:06 + @@ -27,6 +27,7 @@ m4_include(libpopt.m4) m4_include(libtalloc.m4) m4_include(libtdb.m4) +m4_include(libevents.m4) m4_include(ib/config.m4) AC_SUBST(EXTRA_OBJ)
Rev 257: - added a EVENT_FD_AUTOCLOSE flag that allows you to tell the event system to close the fd automatically when a fd_event is freed. This prevents races which can lead to epoll missing events i
revno: 257 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 17:17:25 +1000 message: - added a EVENT_FD_AUTOCLOSE flag that allows you to tell the event system to close the fd automatically when a fd_event is freed. This prevents races which can lead to epoll missing events - added autoconf rules for automatically building with epoll support added: lib/events/libevents.m4libevents.m4-20070505071540-g8d5bc9j71yj33ct-1 modified: lib/events/events.cevents.c-20061117234101-o3qt14umlg9en8z0-26 lib/events/events.hevents.h-20061117234101-o3qt14umlg9en8z0-27 lib/events/events_aio.cevents_aio.c-20070501213746-4fxluwiq4rcxib8p-1 lib/events/events_epoll.c events_epoll.c-20070501213746-4fxluwiq4rcxib8p-2 lib/events/events_liboop.c events_liboop.c-20061117234101-o3qt14umlg9en8z0-29 lib/events/events_select.c events_select.c-20070501213746-4fxluwiq4rcxib8p-3 lib/events/events_standard.c events_standard.c-20061117234101-o3qt14umlg9en8z0-30 lib/replace/system/select.hselect.h-20070125040949-7t3f5zdl1q4z9hyv-88 Diff too large for email (264, the limit is 200).
Rev 262: merge relevant lib code from samba4 in http://samba.org/~tridge/ctdb
revno: 262 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 17:46:54 +1000 message: merge relevant lib code from samba4 modified: lib/events/config.m4 config.m4-20061117234101-o3qt14umlg9en8z0-24 lib/events/events_aio.cevents_aio.c-20070501213746-4fxluwiq4rcxib8p-1 lib/events/events_epoll.c events_epoll.c-20070501213746-4fxluwiq4rcxib8p-2 lib/events/events_internal.h events_internal.h-20061117234101-o3qt14umlg9en8z0-28 lib/events/events_select.c events_select.c-20070501213746-4fxluwiq4rcxib8p-3 lib/events/events_standard.c events_standard.c-20061117234101-o3qt14umlg9en8z0-30 lib/events/events_timed.c events_timed.c-20070501213746-4fxluwiq4rcxib8p-5 lib/tdb/Makefile.inmakefile.in-20070125040949-7t3f5zdl1q4z9hyv-59 lib/tdb/configure.ac configure.ac-20070125040949-7t3f5zdl1q4z9hyv-65 Diff too large for email (281, the limit is 200).
Rev 261: merged vnn map broadcast from ronnie in http://samba.org/~tridge/ctdb
revno: 261 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 17:35:28 +1000 message: merged vnn map broadcast from ronnie modified: common/ctdb.c ctdb.c-20061127094323-t50f58d65iaao5of-2 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2 common/ctdb_traverse.c ctdb_traverse.c-20070503021550-ztfs5rwx8jfm8qqx-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 197.1.57 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Sat 2007-05-05 13:17:26 +1000 message: split the vnn broadcast address into two one broadcast address for all nodes and one broadcast address for all nodes in the current vnnmap update all useage of the old flag to now only broadcast to the vnnmap except for tools/ctdb_control where it makes more sense to broadcast to all nodes revno: 197.1.56 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Sat 2007-05-05 11:46:44 +1000 message: merge from tridge === modified file 'common/ctdb.c' --- a/common/ctdb.c 2007-05-04 22:11:54 + +++ b/common/ctdb.c 2007-05-05 03:17:26 + @@ -469,7 +469,7 @@ /* broadcast a packet to all nodes */ -static void ctdb_broadcast_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) +static void ctdb_broadcast_packet_all(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) { int i; for (i=0;ictdb_get_num_nodes(ctdb);i++) { @@ -479,14 +479,30 @@ } /* + broadcast a packet to all nodes in the current vnnmap +*/ +static void ctdb_broadcast_packet_vnnmap(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) +{ + int i; + for (i=0;ictdb-vnn_map-size;i++) { + hdr-destnode = ctdb-vnn_map-map[i]; + ctdb_queue_packet(ctdb, hdr); + } +} + +/* queue a packet or die */ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) { struct ctdb_node *node; - if (hdr-destnode == CTDB_BROADCAST_VNN) { - ctdb_broadcast_packet(ctdb, hdr); + switch (hdr-destnode) { + case CTDB_BROADCAST_ALL: + ctdb_broadcast_packet_all(ctdb, hdr); + return; + case CTDB_BROADCAST_VNNMAP: + ctdb_broadcast_packet_vnnmap(ctdb, hdr); return; } === modified file 'common/ctdb_control.c' --- a/common/ctdb_control.c 2007-05-05 04:09:46 + +++ b/common/ctdb_control.c 2007-05-05 07:35:28 + @@ -533,7 +533,7 @@ struct ctdb_control_state *state; size_t len; - if (destnode == CTDB_BROADCAST_VNN !(flags CTDB_CTRL_FLAG_NOREPLY)) { + if (((destnode == CTDB_BROADCAST_VNNMAP) || (destnode == CTDB_BROADCAST_VNNMAP)) !(flags CTDB_CTRL_FLAG_NOREPLY)) { DEBUG(0,(Attempt to broadcast control without NOREPLY\n)); return -1; } === modified file 'common/ctdb_ltdb.c' --- a/common/ctdb_ltdb.c2007-05-05 07:19:59 + +++ b/common/ctdb_ltdb.c2007-05-05 07:35:28 + @@ -387,7 +387,7 @@ } /* tell all the other nodes about this database */ - ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNN, 0, + ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0, CTDB_CONTROL_DB_ATTACH, 0, CTDB_CTRL_FLAG_NOREPLY, indata, NULL, NULL); @@ -433,7 +433,7 @@ TDB_DATA data; data.dptr = (uint8_t *)ctdb_db-db_id; data.dsize = sizeof(uint32_t); - ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNN, 0, + ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0, CTDB_CONTROL_UPDATE_SEQNUM, 0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL); } === modified file 'common/ctdb_traverse.c' --- a/common/ctdb_traverse.c2007-05-05 07:19:59 + +++ b/common/ctdb_traverse.c2007-05-05 07:35:28 + @@ -262,7 +262,7 @@ data.dsize = sizeof(r); /* tell all the nodes in the cluster to start sending records to this node */ - ret = ctdb_daemon_send_control(ctdb
Rev 250: added seqnum propogation code to ctdb in http://samba.org/~tridge/ctdb
revno: 250 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Fri 2007-05-04 22:18:00 +1000 message: added seqnum propogation code to ctdb modified: common/ctdb.c ctdb.c-20061127094323-t50f58d65iaao5of-2 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 lib/tdb/common/tdb.c tdb.c-20070220022425-m1wibgjq7n5hahs6-9 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 Diff too large for email (236, the limit is 200).
svn commit: samba r22670 - in branches/SAMBA_4_0/source/torture/raw: .
Author: tridge Date: 2007-05-04 12:41:28 + (Fri, 04 May 2007) New Revision: 22670 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22670 Log: changed the RAW-NOTIFY test to support clustered testing (two nodes) Modified: branches/SAMBA_4_0/source/torture/raw/notify.c Changeset: Modified: branches/SAMBA_4_0/source/torture/raw/notify.c === --- branches/SAMBA_4_0/source/torture/raw/notify.c 2007-05-04 11:26:25 UTC (rev 22669) +++ branches/SAMBA_4_0/source/torture/raw/notify.c 2007-05-04 12:41:28 UTC (rev 22670) @@ -55,7 +55,8 @@ /* basic testing of change notify on directories */ -static BOOL test_notify_dir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static BOOL test_notify_dir(struct smbcli_state *cli, struct smbcli_state *cli2, + TALLOC_CTX *mem_ctx) { BOOL ret = True; NTSTATUS status; @@ -110,7 +111,7 @@ printf(testing notify mkdir\n); req = smb_raw_changenotify_send(cli-tree, notify); - smbcli_mkdir(cli-tree, BASEDIR \\subdir-name); + smbcli_mkdir(cli2-tree, BASEDIR \\subdir-name); status = smb_raw_changenotify_recv(req, mem_ctx, notify); CHECK_STATUS(status, NT_STATUS_OK); @@ -122,7 +123,7 @@ printf(testing notify rmdir\n); req = smb_raw_changenotify_send(cli-tree, notify); - smbcli_rmdir(cli-tree, BASEDIR \\subdir-name); + smbcli_rmdir(cli2-tree, BASEDIR \\subdir-name); status = smb_raw_changenotify_recv(req, mem_ctx, notify); CHECK_STATUS(status, NT_STATUS_OK); @@ -132,10 +133,10 @@ printf(testing notify mkdir - rmdir - mkdir - rmdir\n); - smbcli_mkdir(cli-tree, BASEDIR \\subdir-name); - smbcli_rmdir(cli-tree, BASEDIR \\subdir-name); - smbcli_mkdir(cli-tree, BASEDIR \\subdir-name); - smbcli_rmdir(cli-tree, BASEDIR \\subdir-name); + smbcli_mkdir(cli2-tree, BASEDIR \\subdir-name); + smbcli_rmdir(cli2-tree, BASEDIR \\subdir-name); + smbcli_mkdir(cli2-tree, BASEDIR \\subdir-name); + smbcli_rmdir(cli2-tree, BASEDIR \\subdir-name); req = smb_raw_changenotify_send(cli-tree, notify); status = smb_raw_changenotify_recv(req, mem_ctx, notify); CHECK_STATUS(status, NT_STATUS_OK); @@ -174,11 +175,14 @@ notify.nttrans.in.file.fnum = fnum; req = smb_raw_changenotify_send(cli-tree, notify); + status = smbcli_unlink(cli-tree, BASEDIR \\nonexistant.txt); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); + /* (1st unlink) as the 2nd notify directly returns, this unlink is only seen by the 1st notify and the 3rd notify (later) */ printf(testing notify on unlink for the first file\n); - status = smbcli_unlink(cli-tree, BASEDIR \\test0.txt); + status = smbcli_unlink(cli2-tree, BASEDIR \\test0.txt); CHECK_STATUS(status, NT_STATUS_OK); /* receive the reply from the 2nd notify */ @@ -186,24 +190,27 @@ CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(notify.nttrans.out.num_changes, count); - for (i=1;inotify.nttrans.out.num_changes;i++) { + for (i=1;icount;i++) { CHECK_VAL(notify.nttrans.out.changes[i].action, NOTIFY_ACTION_ADDED); } CHECK_WSTR(notify.nttrans.out.changes[0].name, test0.txt, STR_UNICODE); - /* and now from the 1st notify */ + printf(and now from the 1st notify\n); status = smb_raw_changenotify_recv(req2, mem_ctx, notify); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(notify.nttrans.out.num_changes, 1); CHECK_VAL(notify.nttrans.out.changes[0].action, NOTIFY_ACTION_REMOVED); CHECK_WSTR(notify.nttrans.out.changes[0].name, test0.txt, STR_UNICODE); - /* (3rd notify) this notify will only see the 1st unlink */ + printf((3rd notify) this notify will only see the 1st unlink\n); req = smb_raw_changenotify_send(cli-tree, notify); + status = smbcli_unlink(cli-tree, BASEDIR \\nonexistant.txt); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); + printf(testing notify on wildcard unlink for %d files\n, count-1); /* (2nd unlink) do a wildcard unlink */ - status = smbcli_unlink(cli-tree, BASEDIR \\test*.txt); + status = smbcli_unlink(cli2-tree, BASEDIR \\test*.txt); CHECK_STATUS(status, NT_STATUS_OK); /* receive the 3rd notify */ @@ -1149,13 +1156,16 @@ */ BOOL torture_raw_notify(struct torture_context *torture) { - struct smbcli_state *cli; + struct smbcli_state *cli, *cli2; BOOL ret = True; TALLOC_CTX *mem_ctx; if (!torture_open_connection(cli, 0)) { return False; } + if (!torture_open_connection(cli2, 0)) { + return False; + } mem_ctx = talloc_init
Rev 251: merged from ronnie in http://samba.org/~tridge/ctdb
revno: 251 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 07:39:23 +1000 message: merged from ronnie modified: common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 direct/recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tests/ctdb_test.c ctdb_test.c-20061117234101-o3qt14umlg9en8z0-16 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 197.1.55 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Sat 2007-05-05 01:22:30 +1000 message: merge from tridge revno: 197.1.54 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-04 17:05:28 +1000 message: merge from tridge revno: 197.1.53 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-04 15:25:57 +1000 message: remove a exit from the test script revno: 197.1.52 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-04 15:21:40 +1000 message: recovery daemon this program is a client to the local ctdb daemon every second it pulls all vnnmap and nodemaps from all nodes that are available and checks if a recovery is required a recovery is required if : * all nodes do NOT have an identical vnnmap and generation * all nodes do NOT have an identical nodemap * there are active nodes that are NOT in the nodemap * there are nodes in the nodemap that are NOT active During recovery, the recovery tool will also make sure that all nodes know about and have created all databases. revno: 197.1.51 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-04 11:57:45 +1000 message: also verify that the generation id is the same on all the nodes and if not, trigger a recovery revno: 197.1.50 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-04 11:51:07 +1000 message: merge from tridge Diff too large for email (845, the limit is 200).
Rev 252: - added counters for controls in ctdb_control status in http://samba.org/~tridge/ctdb
revno: 252 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 08:11:54 +1000 message: - added counters for controls in ctdb_control status modified: common/ctdb.c ctdb.c-20061127094323-t50f58d65iaao5of-2 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (306, the limit is 200).
Rev 253: - fixed a crash bug after client disconnect in ctdb_control in http://samba.org/~tridge/ctdb
revno: 253 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 08:33:35 +1000 message: - fixed a crash bug after client disconnect in ctdb_control - added total memory used to ctdb_control status output modified: common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 === modified file 'common/ctdb_control.c' --- a/common/ctdb_control.c 2007-05-04 22:11:54 + +++ b/common/ctdb_control.c 2007-05-04 22:33:35 + @@ -158,6 +158,7 @@ case CTDB_CONTROL_STATUS: { CHECK_CONTROL_DATA_SIZE(0); ctdb-status.controls.status++; + ctdb-status.memory_used = talloc_total_size(ctdb); outdata-dptr = (uint8_t *)ctdb-status; outdata-dsize = sizeof(ctdb-status); return 0; @@ -499,8 +500,11 @@ data.dptr = c-data[0]; data.dsize = c-datalen; + /* make state a child of the packet, so it goes away when the packet + is freed. */ + talloc_steal(hdr, state); + state-callback(ctdb, c-status, data, state-private_data); - talloc_free(state); } static int ctdb_control_destructor(struct ctdb_control_state *state) @@ -528,7 +532,9 @@ return -1; } - state = talloc(ctdb, struct ctdb_control_state); + /* the state is made a child of private_data if possible. This means any reply + will be discarded if the private_data goes away */ + state = talloc(private_data?private_data:ctdb, struct ctdb_control_state); CTDB_NO_MEMORY(ctdb, state); state-reqid = ctdb_reqid_new(ctdb, state); === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2007-05-04 22:11:54 + +++ b/include/ctdb_private.h2007-05-04 22:33:35 + @@ -175,6 +175,7 @@ uint32_t lockwait_calls; uint32_t traverse_calls; uint32_t pending_lockwait_calls; + uint32_t memory_used; uint32_t __last_counter; /* hack for control_status_all */ uint32_t max_hop_count; double max_call_latency; === modified file 'tools/ctdb_control.c' --- a/tools/ctdb_control.c 2007-05-04 22:11:54 + +++ b/tools/ctdb_control.c 2007-05-04 22:33:35 + @@ -135,6 +135,7 @@ STATUS_FIELD(lockwait_calls), STATUS_FIELD(traverse_calls), STATUS_FIELD(pending_lockwait_calls), + STATUS_FIELD(memory_used), STATUS_FIELD(max_hop_count), }; printf(CTDB version %u\n, CTDB_VERSION);
Rev 254: added a dumpmemory control, used to find memory leaks in http://samba.org/~tridge/ctdb
revno: 254 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 11:03:10 +1000 message: added a dumpmemory control, used to find memory leaks modified: common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 === modified file 'common/ctdb_control.c' --- a/common/ctdb_control.c 2007-05-04 22:33:35 + +++ b/common/ctdb_control.c 2007-05-05 01:03:10 + @@ -164,6 +164,12 @@ return 0; } + case CTDB_CONTROL_DUMP_MEMORY: { + CHECK_CONTROL_DATA_SIZE(0); + talloc_report_full(ctdb, stdout); + return 0; + } + case CTDB_CONTROL_STATUS_RESET: { CHECK_CONTROL_DATA_SIZE(0); ZERO_STRUCT(ctdb-status); === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2007-05-04 22:33:35 + +++ b/include/ctdb_private.h2007-05-05 01:03:10 + @@ -306,6 +306,7 @@ CTDB_CONTROL_ENABLE_SEQNUM, CTDB_CONTROL_UPDATE_SEQNUM, CTDB_CONTROL_SET_SEQNUM_FREQUENCY, + CTDB_CONTROL_DUMP_MEMORY, }; === modified file 'tools/ctdb_control.c' --- a/tools/ctdb_control.c 2007-05-04 22:33:35 + +++ b/tools/ctdb_control.c 2007-05-05 01:03:10 + @@ -935,6 +935,28 @@ } /* + dump memory usage + */ +static int control_dumpmemory(struct ctdb_context *ctdb, int argc, const char **argv) +{ + + uint32_t vnn; + if (argc 1) { + usage(); + } + if (strcmp(argv[0], all) == 0) { + vnn = CTDB_BROADCAST_VNN; + } else { + vnn = strtoul(argv[0], NULL, 0); + } + + ctdb_control(ctdb, vnn, 0, CTDB_CONTROL_DUMP_MEMORY, +CTDB_CTRL_FLAG_NOREPLY, tdb_null, NULL, NULL, NULL, NULL); + + return 0; +} + +/* main program */ int main(int argc, const char *argv[]) @@ -976,6 +998,7 @@ { recover, control_recover }, { writerecord, control_writerecord }, { attach, control_attach }, + { dumpmemory, control_dumpmemory }, }; pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
Rev 255: show number of connected clients in status output in http://samba.org/~tridge/ctdb
revno: 255 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Sat 2007-05-05 14:09:46 +1000 message: show number of connected clients in status output modified: common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 === modified file 'common/ctdb_control.c' --- a/common/ctdb_control.c 2007-05-05 01:03:10 + +++ b/common/ctdb_control.c 2007-05-05 04:09:46 + @@ -359,7 +359,7 @@ case CTDB_CONTROL_PING: CHECK_CONTROL_DATA_SIZE(0); ctdb-status.controls.ping++; - return ctdb-num_clients; + return ctdb-status.num_clients; case CTDB_CONTROL_GET_DBNAME: { uint32_t db_id; === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-04 01:41:29 + +++ b/common/ctdb_daemon.c 2007-05-05 04:09:46 + @@ -248,7 +248,7 @@ static int ctdb_client_destructor(struct ctdb_client *client) { ctdb_reqid_remove(client-ctdb, client-client_id); - client-ctdb-num_clients--; + client-ctdb-status.num_clients--; close(client-fd); client-fd = -1; return 0; @@ -559,7 +559,7 @@ client-ctdb = ctdb; client-fd = fd; client-client_id = ctdb_reqid_new(ctdb, client); - ctdb-num_clients++; + ctdb-status.num_clients++; client-queue = ctdb_queue_setup(ctdb, client, fd, CTDB_DS_ALIGNMENT, ctdb_daemon_read_cb, client); === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2007-05-05 01:03:10 + +++ b/include/ctdb_private.h2007-05-05 04:09:46 + @@ -131,6 +131,7 @@ ctdb status information */ struct ctdb_status { + uint32_t num_clients; uint32_t client_packets_sent; uint32_t client_packets_recv; uint32_t node_packets_sent; === modified file 'tools/ctdb_control.c' --- a/tools/ctdb_control.c 2007-05-05 01:03:10 + +++ b/tools/ctdb_control.c 2007-05-05 04:09:46 + @@ -97,6 +97,7 @@ uint32_t offset; } fields[] = { #define STATUS_FIELD(n) { #n, offsetof(struct ctdb_status, n) } + STATUS_FIELD(num_clients), STATUS_FIELD(client_packets_sent), STATUS_FIELD(client_packets_recv), STATUS_FIELD(node_packets_sent),
Rev 243: first version of traverse is working in http://samba.org/~tridge/ctdb
revno: 243 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-03 17:12:23 +1000 message: first version of traverse is working modified: common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_message.c ctdb_message.c-20070208224107-9dnio7x7z33prrmt-1 common/ctdb_traverse.c ctdb_traverse.c-20070503021550-ztfs5rwx8jfm8qqx-1 common/ctdb_util.c ctdb_util.c-20061128065342-to93h6eejj5kon81-3 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tests/ctdb_test.c ctdb_test.c-20061117234101-o3qt14umlg9en8z0-16 Diff too large for email (751, the limit is 200).
Rev 244: merge from ronnie in http://samba.org/~tridge/ctdb
revno: 244 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Fri 2007-05-04 10:43:39 +1000 message: merge from ronnie added: direct/recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tests/ctdbd.sh ctdbd.sh-20070411085038-phusiewluwzyqjpc-2 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 197.1.49 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-04 09:45:53 +1000 message: update getvnnmap control to take a timeout parameter dont explicitely free the vnnmap pointer in the getvnnmap control this is freed by the mem_ctx instead add code to the recoverd to detect when/if recovery is required veiry that the number of active nodes, the nodemap and the vnn map is consistent across the entire cluster and if not trigger a recovery (which right now just prints we need to do recovery to the screen. revno: 197.1.48 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-04 09:01:01 +1000 message: change the signature for ctdb_ctrl_getnodemap() so that a timeout parameter is added. change ctdb_get_connected_nodes in the same way revno: 197.1.47 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-04 08:32:02 +1000 message: ctdb_control should use the provided timeout and not hardcode to 1.0 seconds revno: 197.1.46 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Fri 2007-05-04 08:30:18 +1000 message: start working on a recovery daemon change ctdb_control so it takes a timeval pointer as argument. this is the timeout. if the node has not responded within hte timeout ctdb_control will return an error instead of hanging. if the timeval pointer is NULL then the call will block indefinitely if there is no response. this is used for now in the createdb control but all the helpers ctdb_ctrl_* should probably be updated to take a timeout parameter as well. revno: 197.1.45 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-03 17:16:38 +1000 message: merge from tridge revno: 197.1.44 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-03 16:18:03 +1000 message: cleanup the control write record revno: 197.1.43 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-03 14:42:53 +1000 message: merge from tridge Diff too large for email (1019, the limit is 200).
Rev 245: - changed the REQ_REGISTER PDU to be a control in http://samba.org/~tridge/ctdb
revno: 245 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Fri 2007-05-04 11:41:29 +1000 message: - changed the REQ_REGISTER PDU to be a control - allow controls to know which client invoked them - added a client_id to clients, so they can be identified remotely - added the ability to remove registered srvids - in the list_keys code, register a temp srvid, then remove it afterwards modified: common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2 common/ctdb_message.c ctdb_message.c-20070208224107-9dnio7x7z33prrmt-1 common/ctdb_traverse.c ctdb_traverse.c-20070503021550-ztfs5rwx8jfm8qqx-1 direct/ctdbd_test.cctdbd_test.c-20070411085057-17kgjzfktsh28g99-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tests/ctdbd.sh ctdbd.sh-20070411085038-phusiewluwzyqjpc-2 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (444, the limit is 200).
Rev 246: nicer interface to ctdb traverse in http://samba.org/~tridge/ctdb
revno: 246 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Fri 2007-05-04 12:18:39 +1000 message: nicer interface to ctdb traverse modified: common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 tests/ctdb_test.c ctdb_test.c-20061117234101-o3qt14umlg9en8z0-16 tests/ctdbd.sh ctdbd.sh-20070411085038-phusiewluwzyqjpc-2 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (305, the limit is 200).
Rev 247: make catdb take a dbname instead of an id in http://samba.org/~tridge/ctdb
revno: 247 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Fri 2007-05-04 13:25:30 +1000 message: make catdb take a dbname instead of an id modified: tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 === modified file 'tools/ctdb_control.c' --- a/tools/ctdb_control.c 2007-05-04 02:18:39 + +++ b/tools/ctdb_control.c 2007-05-04 03:25:30 + @@ -46,7 +46,7 @@ getdbmap vnn lists databases on a node\n getnodemap vnn lists nodes known to a ctdb daemon\n createdb vnn dbnamecreate a database\n - catdb dbid lists all keys/data in a db\n + catdb dbname lists all keys/data in a db\n cpdb fromvnn tovnn dbid lists all keys in a remote tdb\n setdmaster vnn dbid dmaster sets new dmaster for all records in the database\n cleardb vnn dbid deletes all records in a db\n @@ -512,7 +512,7 @@ */ static int control_catdb(struct ctdb_context *ctdb, int argc, const char **argv) { - uint32_t dbid; + const char *db_name; struct ctdb_db_context *ctdb_db; int ret; @@ -520,11 +520,10 @@ usage(); } - dbid = strtoul(argv[0], NULL, 0); - - ctdb_db = find_ctdb_db(ctdb, dbid); + db_name = argv[0]; + ctdb_db = ctdb_attach(ctdb, db_name); if (ctdb_db == NULL) { - printf(Unable to find database 0x%x\n, dbid); + DEBUG(0,(Unable to attach to database '%s'\n, db_name)); return -1; } @@ -534,6 +533,8 @@ return -1; } + talloc_free(ctdb_db); + printf(Dumped %d records\n, ret); return 0; }
Rev 249: added a ctdb control for enabling the tdb seqnum in http://samba.org/~tridge/ctdb
revno: 249 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Fri 2007-05-04 15:33:28 +1000 message: added a ctdb control for enabling the tdb seqnum modified: common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 === modified file 'common/ctdb_control.c' --- a/common/ctdb_control.c 2007-05-04 01:41:29 + +++ b/common/ctdb_control.c 2007-05-04 05:33:28 + @@ -395,6 +395,16 @@ case CTDB_CONTROL_DEREGISTER_SRVID: return daemon_deregister_message_handler(ctdb, client_id, srvid); + case CTDB_CONTROL_ENABLE_SEQNUM: { + uint32_t db_id; + struct ctdb_db_context *ctdb_db; + CHECK_CONTROL_DATA_SIZE(sizeof(db_id)); + ctdb_db = find_ctdb_db(ctdb, db_id); + if (!ctdb_db) return -1; + tdb_enable_seqnum(ctdb_db-ltdb-tdb); + return 0; + } + default: DEBUG(0,(__location__ Unknown CTDB control opcode %u\n, opcode)); return -1; === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2007-05-04 01:41:29 + +++ b/include/ctdb_private.h2007-05-04 05:33:28 + @@ -282,6 +282,7 @@ CTDB_CONTROL_TRAVERSE_DATA, CTDB_CONTROL_REGISTER_SRVID, CTDB_CONTROL_DEREGISTER_SRVID, + CTDB_CONTROL_ENABLE_SEQNUM, };
Rev 248: added a tdb_enable_seqnum() function in http://samba.org/~tridge/ctdb
revno: 248 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Fri 2007-05-04 15:29:10 +1000 message: added a tdb_enable_seqnum() function modified: lib/tdb/common/tdb.c tdb.c-20070220022425-m1wibgjq7n5hahs6-9 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 === modified file 'lib/tdb/common/tdb.c' --- a/lib/tdb/common/tdb.c 2007-04-16 12:52:58 + +++ b/lib/tdb/common/tdb.c 2007-05-04 05:29:10 + @@ -649,3 +649,11 @@ return tdb-flags; } + +/* + enable sequence number handling on an open tdb +*/ +void tdb_enable_seqnum(struct tdb_context *tdb) +{ + tdb-flags |= TDB_SEQNUM; +} === modified file 'lib/tdb/include/tdb.h' --- a/lib/tdb/include/tdb.h 2007-04-16 13:03:36 + +++ b/lib/tdb/include/tdb.h 2007-05-04 05:29:10 + @@ -131,6 +131,7 @@ int tdb_hash_size(struct tdb_context *tdb); size_t tdb_map_size(struct tdb_context *tdb); int tdb_get_flags(struct tdb_context *tdb); +void tdb_enable_seqnum(struct tdb_context *tdb); /* Low level locking functions: use with care */ int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key);
Rev 234: added a builtin fetch function to support samba3 unlocked fetch in http://samba.org/~tridge/ctdb
revno: 234 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Wed 2007-05-02 15:11:11 +1000 message: added a builtin fetch function to support samba3 unlocked fetch modified: common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 === modified file 'common/ctdb_ltdb.c' --- a/common/ctdb_ltdb.c2007-05-01 03:25:02 + +++ b/common/ctdb_ltdb.c2007-05-02 05:11:11 + @@ -50,6 +50,15 @@ return 0; } +/* + this is a plain fetch procedure that all databases support +*/ +static int ctdb_fetch_func(struct ctdb_call_info *call) +{ + call-reply_data = call-record_data; + return 0; +} + /* return the lmaster given a key @@ -366,6 +375,17 @@ talloc_free(ctdb_db); return -1; } + + /* + all databases support the fetch function. we need this + for efficient Samba3 ctdb fetch + */ + ret = ctdb_daemon_set_call(ctdb, ctdb_db-db_id, ctdb_fetch_func, CTDB_FETCH_FUNC); + if (ret != 0) { + DEBUG(0,(Failed to setup fetch function for '%s'\n, ctdb_db-db_name)); + talloc_free(ctdb_db); + return -1; + } /* tell all the other nodes about this database */ ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNN, 0, === modified file 'include/ctdb.h' --- a/include/ctdb.h2007-05-02 00:53:29 + +++ b/include/ctdb.h2007-05-02 05:11:11 + @@ -180,25 +180,10 @@ Fetch a ctdb record from a remote node . Underneath this will force the dmaster for the record to be moved to the local node. - */ struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TALLOC_CTX *mem_ctx, TDB_DATA key, TDB_DATA *data); - -/* - do a fetch lock from a client to the local daemon -*/ -#define FETCH_LOCK_SUCCESS 0 -#define FETCH_LOCK_LOCKFAILED 1 -#define FETCH_LOCK_FETCHFAILED 2 -#define FETCH_LOCK_DMASTERFAILED 3 - -int ctdb_client_fetch_lock(struct ctdb_db_context *ctdb_db, - TALLOC_CTX *mem_ctx, - TDB_DATA key, TDB_DATA *data); - - int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data); int ctdb_register_message_handler(struct ctdb_context *ctdb, === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2007-05-02 01:02:04 + +++ b/include/ctdb_private.h2007-05-02 05:11:11 + @@ -30,7 +30,8 @@ #define CTDB_DS_ALIGNMENT 8 -#define CTDB_NULL_FUNC 0xF001 +#define CTDB_NULL_FUNC 0xFF01 +#define CTDB_FETCH_FUNC 0xFF02 #define CTDB_CURRENT_NODE 0xF001 #define CTDB_BROADCAST_VNN 0xF002 === modified file 'tools/ctdb_control.c' --- a/tools/ctdb_control.c 2007-05-02 03:34:55 + +++ b/tools/ctdb_control.c 2007-05-02 05:11:11 + @@ -50,7 +50,8 @@ cleardb vnn dbid deletes all records in a db\n getrecmode vnn get recovery mode\n setrecmode vnn modeset recovery mode\n - recover vnn recover the cluster\n); + recover vnn recover the cluster\n + attach dbnameattach a database\n); exit(1); }
Re: svn commit: samba r22638 - in tags: .
Jelmer, The sourceforge project with TDB and the package in Debian both use 1.0.1 as version number. I figured the support for transactions and the other improvements qualified for a new minor release. I'd vote for 2.0 - tdb has really improved a lot since the sourceforge project split off. Cheers, Tridge
Rev 236: fixed a memory leak in the ctdb_control code in http://samba.org/~tridge/ctdb
revno: 236 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-03 05:51:46 +1000 message: fixed a memory leak in the ctdb_control code modified: common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-02 01:02:04 + +++ b/common/ctdb_daemon.c 2007-05-02 19:51:46 + @@ -810,7 +810,7 @@ /* construct a message to send to the client containing the data */ len = offsetof(struct ctdb_reply_control, data) + data.dsize; - r = ctdbd_allocate_pkt(ctdb, client, CTDB_REPLY_CONTROL, len, + r = ctdbd_allocate_pkt(ctdb, state, CTDB_REPLY_CONTROL, len, struct ctdb_reply_control); CTDB_NO_MEMORY_VOID(ctdb, r);
Rev 235: enabled built in popt if system doesn't have it in http://samba.org/~tridge/ctdb
revno: 235 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-03 05:21:14 +1000 message: enabled built in popt if system doesn't have it modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 configure.ac configure.ac-20061117234101-o3qt14umlg9en8z0-10 lib/popt/libpopt.m4libpopt.m4-20070125040942-nz1rv4zkr26q77uw-7 lib/popt/samba.m4 samba.m4-20070125040942-nz1rv4zkr26q77uw-14 === modified file 'Makefile.in' --- a/Makefile.in 2007-05-02 03:25:45 + +++ b/Makefile.in 2007-05-02 19:21:14 + @@ -8,16 +8,20 @@ libdir = @libdir@ bindir = @bindir@ localstatedir = @localstatedir@ -VPATH = @srcdir@:@tdbdir@:@tallocdir@:@libreplacedir@ +VPATH = @srcdir@:@tdbdir@:@tallocdir@:@libreplacedir@:@poptdir@ srcdir = @srcdir@ builddir = @builddir@ [EMAIL PROTECTED]@ +POPT_LIBS = @POPT_LIBS@ +POPT_CFLAGS = @POPT_CFLAGS@ +POPT_OBJ = @POPT_OBJ@ + CFLAGS=-g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@/include [EMAIL PROTECTED]@ \ - -DVARDIR=\$(localstatedir)\ -DUSE_MMAP=1 @CFLAGS@ + -DVARDIR=\$(localstatedir)\ -DUSE_MMAP=1 @CFLAGS@ $(POPT_CFLAGS) [EMAIL PROTECTED]@ -Llib @LIBS@ -lpopt @INFINIBAND_LIBS@ [EMAIL PROTECTED]@ -Llib @LIBS@ $(POPT_LIBS) @INFINIBAND_LIBS@ EVENTS_OBJ = lib/events/events.o lib/events/events_standard.o \ lib/events/events_signal.o lib/events/events_timed.o @@ -32,7 +36,7 @@ CTDB_TCP_OBJ = tcp/tcp_connect.o tcp/tcp_io.o tcp/tcp_init.o -CTDB_OBJ = $(CTDB_COMMON_OBJ) $(CTDB_TCP_OBJ) +CTDB_OBJ = $(CTDB_COMMON_OBJ) $(CTDB_TCP_OBJ) $(POPT_OBJ) OBJS = @TDB_OBJ@ @TALLOC_OBJ@ @LIBREPLACEOBJ@ @INFINIBAND_WRAPPER_OBJ@ $(EXTRA_OBJ) $(EVENTS_OBJ) $(CTDB_OBJ) $(UTIL_OBJ) === modified file 'configure.ac' --- a/configure.ac 2007-04-10 02:51:54 + +++ b/configure.ac 2007-05-02 19:21:14 + @@ -24,6 +24,7 @@ EXTRA_OBJ= +m4_include(libpopt.m4) m4_include(libtalloc.m4) m4_include(libtdb.m4) m4_include(ib/config.m4) === modified file 'lib/popt/libpopt.m4' --- a/lib/popt/libpopt.m4 2007-01-25 04:10:40 + +++ b/lib/popt/libpopt.m4 2007-05-02 19:21:14 + @@ -37,7 +37,7 @@ if test x$poptdir = x; then AC_MSG_ERROR([cannot find popt source in $poptpaths]) fi - POPTOBJ=popt.o findme.o poptconfig.o popthelp.o poptparse.o - AC_SUBST(POPTOBJ) + POPT_OBJ=popt.o findme.o poptconfig.o popthelp.o poptparse.o + AC_SUBST(POPT_OBJ) AC_CHECK_HEADERS([float.h alloca.h]) fi === modified file 'lib/popt/samba.m4' --- a/lib/popt/samba.m4 2007-01-25 04:10:40 + +++ b/lib/popt/samba.m4 2007-05-02 19:21:14 + @@ -1,6 +1,6 @@ m4_include(lib/popt/libpopt.m4) -if test x$POPTOBJ = x; then +if test x$POPT_OBJ = x; then SMB_EXT_LIB(LIBPOPT, [${POPT_LIBS}]) SMB_ENABLE(LIBPOPT,YES) else
Rev 237: merge from ronnie in http://samba.org/~tridge/ctdb
revno: 237 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-03 07:19:29 +1000 message: merge from ronnie added: direct/4nodes.txt 4nodes.txt-20070502024949-2rkyfp289w532z1l-1 tests/recover.sh recover.sh-20070502031230-tpuiet6m6tjdotta-1 modified: common/ctdb.c ctdb.c-20061127094323-t50f58d65iaao5of-2 common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tests/ctdb_fetch.c ctdb_fetch.c-20070405031748-f7gslozfj3rwh5ie-1 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 197.1.37 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-02 22:00:48 +1000 message: merge from tridge revno: 197.1.36 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-02 21:31:20 +1000 message: do a real recovery by killing a node and then calling the recover control revno: 197.1.35 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-02 21:14:37 +1000 message: recover.sh test script that build a few database and populates them with a record then performs a recovery which merges all records onto node 0 revno: 197.1.34 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-02 21:00:02 +1000 message: add a recover test change alignment for the pull/push db structures revno: 197.1.33 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-02 13:31:42 +1000 message: discard REQ/REPLY DMASTER when generation id is wrong or when in recovery mode revno: 197.1.32 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-02 13:14:12 +1000 message: remove sleep from the fetch test add a test script to start 4 daemons to test recovery revno: 197.1.31 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-02 12:43:35 +1000 message: add a control to create a database revno: 197.1.30 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2007-05-02 11:09:10 +1000 message: remove test code in the fetch test to keep the daemons running forever (so one has lots of tiume to play with ctdb_control) Diff too large for email (662, the limit is 200).
Rev 238: merge from ronnie in http://samba.org/~tridge/ctdb
revno: 238 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-03 07:48:08 +1000 message: merge from ronnie revno: 197.1.39 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-03 07:21:29 +1000 message: merge from tridge revno: 197.1.38 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-03 05:52:45 +1000 message: merge from tridge
Rev 239: merged cleanup from ronnie in http://samba.org/~tridge/ctdb
revno: 239 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-03 11:13:01 +1000 message: merged cleanup from ronnie added: common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 common/cmdline.c cmdline.c-20070416041216-w1zvz91bkdsgjckw-1 common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 197.1.40 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-03 11:06:24 +1000 message: break set/get vnn map out from ctdb_control and put it in ctdb_recover.c for the time being remove all the [de]marshalling and just pass a structure around instead Diff too large for email (393, the limit is 200).
Rev 240: first stage of efficient non-blocking ctdb traverse in http://samba.org/~tridge/ctdb
revno: 240 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-03 12:16:03 +1000 message: first stage of efficient non-blocking ctdb traverse added: common/ctdb_traverse.c ctdb_traverse.c-20070503021550-ztfs5rwx8jfm8qqx-1 modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 common/ctdb_io.c ctdb_io.c-20070409200335-dzfc7f3rra5rcf60-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (242, the limit is 200).
Rev 241: don't zero beyond packet header unnecessarily in http://samba.org/~tridge/ctdb
revno: 241 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-03 13:44:27 +1000 message: don't zero beyond packet header unnecessarily modified: common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 === modified file 'common/ctdb_daemon.c' --- a/common/ctdb_daemon.c 2007-05-02 19:51:46 + +++ b/common/ctdb_daemon.c 2007-05-03 03:44:27 + @@ -727,7 +727,9 @@ { int size; struct ctdb_req_header *hdr; - size = ((length+1)+(CTDB_DS_ALIGNMENT-1)) ~(CTDB_DS_ALIGNMENT-1); + + length = MAX(length, slength); + size = (length+(CTDB_DS_ALIGNMENT-1)) ~(CTDB_DS_ALIGNMENT-1); hdr = (struct ctdb_req_header *)talloc_size(mem_ctx, size); if (hdr == NULL) { @@ -736,9 +738,9 @@ return NULL; } talloc_set_name_const(hdr, type); - memset(hdr, 0, size); + memset(hdr, 0, slength); + hdr-length = length; hdr-operation= operation; - hdr-length = size; hdr-ctdb_magic = CTDB_MAGIC; hdr-ctdb_version = CTDB_VERSION; hdr-srcnode = ctdb-vnn; @@ -761,7 +763,10 @@ { int size; struct ctdb_req_header *hdr; - size = ((length+1)+(CTDB_DS_ALIGNMENT-1)) ~(CTDB_DS_ALIGNMENT-1); + + length = MAX(length, slength); + size = (length+(CTDB_DS_ALIGNMENT-1)) ~(CTDB_DS_ALIGNMENT-1); + hdr = (struct ctdb_req_header *)ctdb-methods-allocate_pkt(mem_ctx, size); if (hdr == NULL) { DEBUG(0,(Unable to allocate transport packet for operation %u of length %u\n, @@ -769,9 +774,9 @@ return NULL; } talloc_set_name_const(hdr, type); - memset(hdr, 0, size); + memset(hdr, 0, slength); + hdr-length = length; hdr-operation= operation; - hdr-length = size; hdr-ctdb_magic = CTDB_MAGIC; hdr-ctdb_version = CTDB_VERSION; hdr-generation = ctdb-vnn_map-generation;
Rev 242: merged from ronnie in http://samba.org/~tridge/ctdb
revno: 242 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge timestamp: Thu 2007-05-03 13:53:54 +1000 message: merged from ronnie modified: common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 common/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 197.1.42 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-03 13:30:38 +1000 message: cleanup getnodemap revno: 197.1.41 merged: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2007-05-03 13:07:34 +1000 message: fixup getdbmap control so it looks a bit nicer Diff too large for email (546, the limit is 200).
svn commit: samba r22632 - in branches/SAMBA_4_0/source/lib/events: .
Author: tridge Date: 2007-05-01 20:57:54 + (Tue, 01 May 2007) New Revision: 22632 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22632 Log: merged volkers select events fix Modified: branches/SAMBA_4_0/source/lib/events/events_standard.c Changeset: Modified: branches/SAMBA_4_0/source/lib/events/events_standard.c === --- branches/SAMBA_4_0/source/lib/events/events_standard.c 2007-05-01 20:03:44 UTC (rev 22631) +++ branches/SAMBA_4_0/source/lib/events/events_standard.c 2007-05-01 20:57:54 UTC (rev 22632) @@ -380,7 +380,8 @@ fde-additional_data= NULL; DLIST_ADD(std_ev-fd_events, fde); - if (fde-fd std_ev-maxfd) { + if ((std_ev-maxfd != EVENT_INVALID_MAXFD) +(fde-fd std_ev-maxfd)) { std_ev-maxfd = fde-fd; } talloc_set_destructor(fde, std_event_fd_destructor);
svn commit: samba r22634 - in branches/SAMBA_4_0/source/lib/events: .
Author: tridge Date: 2007-05-01 21:29:42 + (Tue, 01 May 2007) New Revision: 22634 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=22634 Log: make the events system much less dependent on the samba4 build system Modified: branches/SAMBA_4_0/source/lib/events/config.mk branches/SAMBA_4_0/source/lib/events/events.c branches/SAMBA_4_0/source/lib/events/events_aio.c branches/SAMBA_4_0/source/lib/events/events_epoll.c branches/SAMBA_4_0/source/lib/events/events_internal.h branches/SAMBA_4_0/source/lib/events/events_select.c branches/SAMBA_4_0/source/lib/events/events_signal.c branches/SAMBA_4_0/source/lib/events/events_standard.c Changeset: Modified: branches/SAMBA_4_0/source/lib/events/config.mk === --- branches/SAMBA_4_0/source/lib/events/config.mk 2007-05-01 21:22:55 UTC (rev 22633) +++ branches/SAMBA_4_0/source/lib/events/config.mk 2007-05-01 21:29:42 UTC (rev 22634) @@ -3,28 +3,28 @@ OBJ_FILES = events_aio.o PRIVATE_DEPENDENCIES = LIBAIO_LINUX SUBSYSTEM = LIBEVENTS -INIT_FUNCTION = events_aio_init +INIT_FUNCTION = s4_events_aio_init ## ## [MODULE::EVENTS_EPOLL] OBJ_FILES = events_epoll.o SUBSYSTEM = LIBEVENTS -INIT_FUNCTION = events_epoll_init +INIT_FUNCTION = s4_events_epoll_init ## ## [MODULE::EVENTS_SELECT] OBJ_FILES = events_select.o SUBSYSTEM = LIBEVENTS -INIT_FUNCTION = events_select_init +INIT_FUNCTION = s4_events_select_init ## ## [MODULE::EVENTS_STANDARD] OBJ_FILES = events_standard.o SUBSYSTEM = LIBEVENTS -INIT_FUNCTION = events_standard_init +INIT_FUNCTION = s4_events_standard_init ## Modified: branches/SAMBA_4_0/source/lib/events/events.c === --- branches/SAMBA_4_0/source/lib/events/events.c 2007-05-01 21:22:55 UTC (rev 22633) +++ branches/SAMBA_4_0/source/lib/events/events.c 2007-05-01 21:29:42 UTC (rev 22634) @@ -58,7 +58,9 @@ #include lib/events/events.h #include lib/events/events_internal.h #include lib/util/dlinklist.h +#if _SAMBA_BUILD_ #include build.h +#endif struct event_ops_list { struct event_ops_list *next, *prev; @@ -72,15 +74,15 @@ /* register an events backend */ -NTSTATUS event_register_backend(const char *name, const struct event_ops *ops) +bool event_register_backend(const char *name, const struct event_ops *ops) { struct event_ops_list *e; e = talloc(talloc_autofree_context(), struct event_ops_list); - NT_STATUS_HAVE_NO_MEMORY(e); + if (e == NULL) return False; e-name = name; e-ops = ops; DLIST_ADD(event_backends, e); - return NT_STATUS_OK; + return True; } /* @@ -88,12 +90,17 @@ */ static void event_backend_init(void) { +#if _SAMBA_BUILD_ init_module_fn static_init[] = STATIC_LIBEVENTS_MODULES; init_module_fn *shared_init; if (event_backends) return; shared_init = load_samba_modules(NULL, LIBEVENTS); run_init_functions(static_init); run_init_functions(shared_init); +#else + bool events_standard_init(void); + events_standard_init(); +#endif } /* Modified: branches/SAMBA_4_0/source/lib/events/events_aio.c === --- branches/SAMBA_4_0/source/lib/events/events_aio.c 2007-05-01 21:22:55 UTC (rev 22633) +++ branches/SAMBA_4_0/source/lib/events/events_aio.c 2007-05-01 21:29:42 UTC (rev 22634) @@ -165,9 +165,9 @@ static void epoll_change_event(struct aio_event_context *aio_ev, struct fd_event *fde) { - BOOL got_error = (fde-additional_flags EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR); - BOOL want_read = (fde-flags EVENT_FD_READ); - BOOL want_write= (fde-flags EVENT_FD_WRITE); + bool got_error = (fde-additional_flags EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR); + bool want_read = (fde-flags EVENT_FD_READ); + bool want_write= (fde-flags EVENT_FD_WRITE); if (aio_ev-epoll_fd == -1) return; @@ -512,7 +512,17 @@ .loop_wait = aio_event_loop_wait, }; -NTSTATUS events_aio_init(void) +bool events_aio_init(void) { return event_register_backend(aio, aio_event_ops); } + +#if _SAMBA_BUILD_ +NTSTATUS s4_events_aio_init(void) +{ + if (!events_aio_init()) { + return NT_STATUS_INTERNAL_ERROR; + } + return NT_STATUS_OK; +} +#endif Modified: branches/SAMBA_4_0/source/lib/events/events_epoll.c === --- branches/SAMBA_4_0/source/lib/events/events_epoll.c 2007-05-01 21:22:55 UTC (rev 22633) +++ branches/SAMBA_4_0/source/lib/events/events_epoll.c 2007-05-01 21:29:42 UTC (rev 22634