lib: Make ctdbd_migrate return 0/errno
authorVolker Lendecke <vl@samba.org>
Sat, 3 Oct 2015 03:42:05 +0000 (20:42 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 7 Oct 2015 21:54:06 +0000 (23:54 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/ctdbd_conn.h
source3/lib/ctdbd_conn.c
source3/lib/dbwrap/dbwrap_ctdb.c

index 7e56a4c6d60d7744464f2ade77d44b871da69f16..6ebd451671869fd75bfced6d40a3a901046acf36 100644 (file)
@@ -54,8 +54,7 @@ char *ctdbd_dbpath(struct ctdbd_connection *conn,
 int ctdbd_db_attach(struct ctdbd_connection *conn, const char *name,
                    uint32_t *db_id, int tdb_flags);
 
-NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id,
-                      TDB_DATA key);
+int ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key);
 
 NTSTATUS ctdbd_parse(struct ctdbd_connection *conn, uint32_t db_id,
                     TDB_DATA key, bool local_copy,
index d759be6fffd3396bfe289bb3f41cd229b695f8ef..899d616cb8cd8ec53aab27a49f6bc2c315ca4301 100644 (file)
@@ -919,14 +919,12 @@ int ctdbd_db_attach(struct ctdbd_connection *conn,
 /*
  * force the migration of a record to this node
  */
-NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id,
-                      TDB_DATA key)
+int ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key)
 {
        struct ctdb_req_call req;
        struct ctdb_req_header *hdr;
        struct iovec iov[2];
        ssize_t nwritten;
-       NTSTATUS status;
        int ret;
 
        ZERO_STRUCT(req);
@@ -958,21 +956,18 @@ NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id,
        ret = ctdb_read_req(conn, req.hdr.reqid, NULL, &hdr);
        if (ret != 0) {
                DEBUG(10, ("ctdb_read_req failed: %s\n", strerror(ret)));
-               status = map_nt_error_from_unix(ret);
                goto fail;
        }
 
        if (hdr->operation != CTDB_REPLY_CALL) {
                DEBUG(0, ("received invalid reply\n"));
-               status = NT_STATUS_INTERNAL_ERROR;
                goto fail;
        }
 
-       status = NT_STATUS_OK;
  fail:
 
        TALLOC_FREE(hdr);
-       return status;
+       return ret;
 }
 
 /*
index c495c5ca9113b0926dc6a98a3b2d6ace0ebbfbfc..57afc85580372f1d3a977e23129cff5d38ff9b27 100644 (file)
@@ -1019,6 +1019,7 @@ static struct db_record *fetch_locked_internal(struct db_ctdb_ctx *ctx,
        double ctdb_time = 0;
        int duration_msecs;
        int lockret;
+       int ret;
 
        if (!(result = talloc(mem_ctx, struct db_record))) {
                DEBUG(0, ("talloc failed\n"));
@@ -1105,13 +1106,13 @@ again:
                           ((struct ctdb_ltdb_header *)ctdb_data.dptr)->flags : 0));
 
                GetTimeOfDay(&ctdb_start_time);
-               status = ctdbd_migrate(messaging_ctdbd_connection(), ctx->db_id,
-                                      key);
+               ret = ctdbd_migrate(messaging_ctdbd_connection(), ctx->db_id,
+                                   key);
                ctdb_time += timeval_elapsed(&ctdb_start_time);
 
-               if (!NT_STATUS_IS_OK(status)) {
+               if (ret != 0) {
                        DEBUG(5, ("ctdb_migrate failed: %s\n",
-                                 nt_errstr(status)));
+                                 strerror(ret)));
                        TALLOC_FREE(result);
                        return NULL;
                }