From 9d11277337113bad885240f2fc53c692c1be99bf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 29 Jun 2012 10:39:07 +0200 Subject: s3:dbwrap_ctdb: fix fetch/fetch_locked when samba is built against old ctdb The introduction of read only copies has broken the algorithm for deteting whether we can use the local record copy for fetch_locked and fetch: For fetch locked the new code always uses the local copy if there is one... This patch re-establish the original algorithm for the build against a ctdb without read only record copies. Reported-by: Gregor Beck --- source3/lib/dbwrap/dbwrap_ctdb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index 1062cb0bbd..01dfacac1a 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -1006,9 +1006,7 @@ static int db_ctdb_record_destr(struct db_record* data) /* Do I own this record? */ static bool db_ctdb_own_record(TDB_DATA ctdb_data, bool read_only) { -#ifdef HAVE_CTDB_WANT_READONLY_DECL struct ctdb_ltdb_header *hdr; -#endif if (ctdb_data.dptr == NULL) return false; @@ -1016,8 +1014,9 @@ static bool db_ctdb_own_record(TDB_DATA ctdb_data, bool read_only) if (ctdb_data.dsize < sizeof(struct ctdb_ltdb_header)) return false; -#ifdef HAVE_CTDB_WANT_READONLY_DECL hdr = (struct ctdb_ltdb_header *)ctdb_data.dptr; + +#ifdef HAVE_CTDB_WANT_READONLY_DECL if (hdr->dmaster != get_my_vnn()) { /* If we're not dmaster, it must be r/o copy. */ return read_only && (hdr->flags & CTDB_REC_RO_HAVE_READONLY); @@ -1026,7 +1025,7 @@ static bool db_ctdb_own_record(TDB_DATA ctdb_data, bool read_only) /* If we want write access, noone can have r/o copies. */ return read_only || !(hdr->flags & CTDB_REC_RO_HAVE_DELEGATIONS); #else - return !read_only; + return (hdr->dmaster == get_my_vnn()); #endif } -- cgit