mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
server: trans2_active: don't report a transaction active on the node that performs the transaction
Otherwise a node can lock itself out, e.g. when a commit control times out... Michael (This used to be ctdb commit cb432e30351d5e5a41e98da3c7b1c2a4d400a3a2)
This commit is contained in:
parent
784a89ec62
commit
0113744fec
@ -1471,6 +1471,7 @@ int32_t ctdb_control_trans2_finished(struct ctdb_context *ctdb,
|
||||
int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb,
|
||||
struct ctdb_req_control *c);
|
||||
int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb,
|
||||
struct ctdb_req_control *c,
|
||||
uint32_t db_id);
|
||||
|
||||
char *ctdb_addr_to_str(ctdb_sock_addr *addr);
|
||||
|
@ -426,7 +426,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
||||
|
||||
case CTDB_CONTROL_TRANS2_ACTIVE:
|
||||
CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
|
||||
return ctdb_control_trans2_active(ctdb, *(uint32_t *)indata.dptr);
|
||||
return ctdb_control_trans2_active(ctdb, c, *(uint32_t *)indata.dptr);
|
||||
|
||||
case CTDB_CONTROL_RECD_PING:
|
||||
CHECK_CONTROL_DATA_SIZE(0);
|
||||
|
@ -608,9 +608,11 @@ int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb,
|
||||
* Tell whether a transaction is active on this node on the give DB.
|
||||
*/
|
||||
int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb,
|
||||
struct ctdb_req_control *c,
|
||||
uint32_t db_id)
|
||||
{
|
||||
struct ctdb_db_context *ctdb_db;
|
||||
struct ctdb_client *client = ctdb_reqid_find(ctdb, c->client_id, struct ctdb_client);
|
||||
|
||||
ctdb_db = find_ctdb_db(ctdb, db_id);
|
||||
if (!ctdb_db) {
|
||||
@ -618,6 +620,10 @@ int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (client->db_id == db_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ctdb_db->transaction_active) {
|
||||
return 1;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user