messaging4: Remove unnecessary locking
authorVolker Lendecke <vl@samba.org>
Thu, 17 Jul 2014 14:50:33 +0000 (14:50 +0000)
committerVolker Lendecke <vl@samba.org>
Mon, 21 Jul 2014 16:00:10 +0000 (18:00 +0200)
We don't do any modifying operations on the database, so locking is not
needed here

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/lib/messaging/messaging.c

index 19a20c471c38263f89342626df4bd077912e7fba..7c05e5291d29d4f67d42e508df3d8e33686178c6 100644 (file)
@@ -960,18 +960,13 @@ struct server_id *irpc_servers_byname(struct imessaging_context *msg_ctx,
        int count, i;
        struct server_id *ret;
 
-       if (tdb_lock_bystring(t->tdb, name) != 0) {
-               return NULL;
-       }
        rec = tdb_fetch_bystring(t->tdb, name);
        if (rec.dptr == NULL) {
-               tdb_unlock_bystring(t->tdb, name);
                return NULL;
        }
        count = rec.dsize / sizeof(struct server_id);
        ret = talloc_array(mem_ctx, struct server_id, count+1);
        if (ret == NULL) {
-               tdb_unlock_bystring(t->tdb, name);
                return NULL;
        }
        for (i=0;i<count;i++) {
@@ -979,7 +974,6 @@ struct server_id *irpc_servers_byname(struct imessaging_context *msg_ctx,
        }
        server_id_set_disconnected(&ret[i]);
        free(rec.dptr);
-       tdb_unlock_bystring(t->tdb, name);
 
        return ret;
 }