s3:dbwrap_ctdb: use db_ctdb_ltdb_fetch() inside db_ctdb_transaction_fetch_start
authorMichael Adam <obnox@samba.org>
Wed, 28 Oct 2009 00:50:15 +0000 (01:50 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 10 Mar 2010 12:22:11 +0000 (13:22 +0100)
Michael

source3/lib/dbwrap_ctdb.c

index e4399c60381e7f26552bcdb75f00cb73960d927c..fce6126a5c0def760b8554e9af0df16315540324 100644 (file)
@@ -322,6 +322,8 @@ static int db_ctdb_transaction_fetch_start(struct db_ctdb_transaction_handle *h)
        int ret;
        struct db_ctdb_ctx *ctx = h->ctx;
        TDB_DATA data;
+       NTSTATUS status;
+       struct ctdb_ltdb_header header;
 
        key.dptr = (uint8_t *)discard_const(keyname);
        key.dsize = strlen(keyname);
@@ -344,17 +346,13 @@ again:
                return -1;
        }
 
-       data = tdb_fetch(ctx->wtdb->tdb, key);
-       if ((data.dptr == NULL) ||
-           (data.dsize < sizeof(struct ctdb_ltdb_header)) ||
-           ((struct ctdb_ltdb_header *)data.dptr)->dmaster != get_my_vnn()) {
-               SAFE_FREE(data.dptr);
+       status = db_ctdb_ltdb_fetch(ctx, key, &header, tmp_ctx, &data);
+       if (!NT_STATUS_IS_OK(status) || header.dmaster != get_my_vnn()) {
                tdb_transaction_cancel(ctx->wtdb->tdb);
                talloc_free(tmp_ctx);
                goto again;
        }
 
-       SAFE_FREE(data.dptr);
        talloc_free(tmp_ctx);
 
        return 0;