diff options
author | Michael Adam <obnox@samba.org> | 2009-07-20 16:34:56 +0200 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-07-29 11:17:07 +1000 |
commit | a6bd36933a0391c039bfc3e4c3652ff52da49670 (patch) | |
tree | b767467597ce77417c427cbcff9202b8c7f819a0 /ctdb/client | |
parent | a6cf23362fff11ae6df89b8de95407295f399f58 (diff) | |
download | samba-a6bd36933a0391c039bfc3e4c3652ff52da49670.tar.gz samba-a6bd36933a0391c039bfc3e4c3652ff52da49670.tar.xz samba-a6bd36933a0391c039bfc3e4c3652ff52da49670.zip |
client: refuse to do record_store() on a persistent tdb.
Only allow stores wrapped in transactions on persistent dbs.
Michael
(This used to be ctdb commit 9dea71cf72ef79a9aadf8ee7cf1a1899527459ff)
Diffstat (limited to 'ctdb/client')
-rw-r--r-- | ctdb/client/ctdb_client.c | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 19a935023f4..f6dbc73a697 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -644,46 +644,12 @@ again: */ int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data) { - int ret; - int32_t status; - struct ctdb_rec_data *rec; - TDB_DATA recdata; - if (h->ctdb_db->persistent) { - h->header.rsn++; - } - - ret = ctdb_ltdb_store(h->ctdb_db, h->key, &h->header, data); - if (ret != 0) { - return ret; - } - - /* don't need the persistent_store control for non-persistent databases */ - if (!h->ctdb_db->persistent) { - return 0; - } - - rec = ctdb_marshall_record(h, h->ctdb_db->db_id, h->key, &h->header, data); - if (rec == NULL) { - DEBUG(DEBUG_ERR,("Unable to marshall record in ctdb_record_store\n")); - return -1; - } - - recdata.dptr = (uint8_t *)rec; - recdata.dsize = rec->length; - - ret = ctdb_control(h->ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, - CTDB_CONTROL_PERSISTENT_STORE, 0, - recdata, NULL, NULL, &status, NULL, NULL); - - talloc_free(rec); - - if (ret != 0 || status != 0) { - DEBUG(DEBUG_ERR,("Failed persistent store in ctdb_record_store\n")); + DEBUG(DEBUG_ERR, (__location__ " ctdb_record_store prohibited for persistent dbs\n")); return -1; } - return 0; + return ctdb_ltdb_store(h->ctdb_db, h->key, &h->header, data); } /* |