The Samba-Bugzilla – Attachment 12254 Details for
Bug 12005
parse_share_modes() chokes on ctdb tombstone record from ltdb
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Possible patch for master
look (text/plain), 4.30 KB, created by
Ralph Böhme
on 2016-07-02 07:27:38 UTC
(
hide
)
Description:
Possible patch for master
Filename:
MIME Type:
Creator:
Ralph Böhme
Created:
2016-07-02 07:27:38 UTC
Size:
4.30 KB
patch
obsolete
>From c26c3c354db42a688551d46d8583352a5c7c9ad7 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Fri, 1 Jul 2016 17:45:53 +0200 >Subject: [PATCH 1/2] WIP: dbwrap_ctdb: move struct db_ctdb_parse_record_state > >Will be needed in the next commit. No change in behavour. > >Signed-off-by: Ralph Boehme <slow@samba.org> >--- > source3/lib/dbwrap/dbwrap_ctdb.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > >diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c >index df5a34f..c557902 100644 >--- a/source3/lib/dbwrap/dbwrap_ctdb.c >+++ b/source3/lib/dbwrap/dbwrap_ctdb.c >@@ -99,6 +99,14 @@ static int db_ctdb_ltdb_parser(TDB_DATA key, TDB_DATA data, > return 0; > } > >+struct db_ctdb_parse_record_state { >+ void (*parser)(TDB_DATA key, TDB_DATA data, void *private_data); >+ void *private_data; >+ uint32_t my_vnn; >+ bool ask_for_readonly_copy; >+ bool done; >+}; >+ > static NTSTATUS db_ctdb_ltdb_parse( > struct db_ctdb_ctx *db, TDB_DATA key, > void (*parser)(TDB_DATA key, struct ctdb_ltdb_header *header, >@@ -1215,14 +1223,6 @@ static struct db_record *db_ctdb_try_fetch_locked(struct db_context *db, > return fetch_locked_internal(ctx, mem_ctx, key, true); > } > >-struct db_ctdb_parse_record_state { >- void (*parser)(TDB_DATA key, TDB_DATA data, void *private_data); >- void *private_data; >- uint32_t my_vnn; >- bool ask_for_readonly_copy; >- bool done; >-}; >- > static void db_ctdb_parse_record_parser( > TDB_DATA key, struct ctdb_ltdb_header *header, > TDB_DATA data, void *private_data) >-- >2.5.0 > > >From 5ddd6e537beffe3fef855d81a0c342a8feda235b Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Fri, 1 Jul 2016 17:21:04 +0200 >Subject: [PATCH 2/2] WIP: dbwrap_ctdb: check for ltdb tombstone records > >When fetching records from remote ctdb nodes via ctdbd_parse() or in >db_ctdb_traverse(), we already checks for tombstone records and skip >them. Add the same check to db_ctdb_ltdb_parser() when fetching records >from the ltbd. > >Signed-off-by: Ralph Boehme <slow@samba.org> >--- > source3/lib/dbwrap/dbwrap_ctdb.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > >diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c >index c557902..b3097b8 100644 >--- a/source3/lib/dbwrap/dbwrap_ctdb.c >+++ b/source3/lib/dbwrap/dbwrap_ctdb.c >@@ -79,6 +79,7 @@ struct db_ctdb_ltdb_parse_state { > void (*parser)(TDB_DATA key, struct ctdb_ltdb_header *header, > TDB_DATA data, void *private_data); > void *private_data; >+ bool tombstone; > }; > > static int db_ctdb_ltdb_parser(TDB_DATA key, TDB_DATA data, >@@ -91,6 +92,14 @@ static int db_ctdb_ltdb_parser(TDB_DATA key, TDB_DATA data, > return -1; > } > >+ if (data.dsize == sizeof(struct ctdb_ltdb_header)) { >+ /* >+ * record tombstone >+ */ >+ state->tombstone = true; >+ return -1; >+ } >+ > state->parser( > key, (struct ctdb_ltdb_header *)data.dptr, > make_tdb_data(data.dptr + sizeof(struct ctdb_ltdb_header), >@@ -105,6 +114,7 @@ struct db_ctdb_parse_record_state { > uint32_t my_vnn; > bool ask_for_readonly_copy; > bool done; >+ bool tombstone; > }; > > static NTSTATUS db_ctdb_ltdb_parse( >@@ -113,6 +123,8 @@ static NTSTATUS db_ctdb_ltdb_parse( > TDB_DATA data, void *private_data), > void *private_data) > { >+ struct db_ctdb_parse_record_state *rec_state = >+ (struct db_ctdb_parse_record_state *)private_data; > struct db_ctdb_ltdb_parse_state state; > int ret; > >@@ -122,6 +134,9 @@ static NTSTATUS db_ctdb_ltdb_parse( > ret = tdb_parse_record(db->wtdb->tdb, key, db_ctdb_ltdb_parser, > &state); > if (ret == -1) { >+ if (state.tombstone) { >+ rec_state->tombstone = true; >+ } > return NT_STATUS_NOT_FOUND; > } > return NT_STATUS_OK; >@@ -1267,6 +1282,7 @@ static NTSTATUS db_ctdb_parse_record(struct db_context *db, TDB_DATA key, > state.parser = parser; > state.private_data = private_data; > state.my_vnn = ctdbd_vnn(ctx->conn); >+ state.tombstone = false; > > if (ctx->transaction != NULL) { > struct db_ctdb_transaction_handle *h = ctx->transaction; >@@ -1301,6 +1317,12 @@ static NTSTATUS db_ctdb_parse_record(struct db_context *db, TDB_DATA key, > return NT_STATUS_OK; > } > >+ if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND) >+ && state.tombstone) >+ { >+ return NT_STATUS_NOT_FOUND; >+ } >+ > ret = ctdbd_parse(ctx->conn, ctx->db_id, key, > state.ask_for_readonly_copy, parser, private_data); > if (ret != 0) { >-- >2.5.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 12005
:
12253
|
12254
|
12255
|
12345
|
12346