From 73184e5785857e7c759e219efd361c0fceec090e Mon Sep 17 00:00:00 2001 From: David Teigland Date: Aug 15 2012 17:20:33 +0000 Subject: sanlock: fix paxos acquire host_id check The host_id check should be skipped in the case where the local host_id was the previous paxos lease owner, but in a previous lockspace generation in which the paxos lease was not cleanly released. Checking our own host_id does nothing and is a waste of time in this case. Signed-off-by: David Teigland --- diff --git a/src/paxos_lease.c b/src/paxos_lease.c index a52c085..68529f3 100644 --- a/src/paxos_lease.c +++ b/src/paxos_lease.c @@ -1156,6 +1156,22 @@ int paxos_lease_acquire(struct task *task, } /* + * We were the last host to hold this lease, but in a previous + * lockspace generation in which we didn't cleanly release the + * paxos lease. + */ + + if (cur_leader.owner_id == token->host_id && + cur_leader.owner_generation < token->host_generation) { + log_token(token, "paxos_acquire past owner id %llu gen %llu %llu", + (unsigned long long)token->host_id, + (unsigned long long)token->host_generation, + (unsigned long long)cur_leader.owner_generation); + copy_cur_leader = 1; + goto run; + } + + /* * Check if current owner is alive based on its host_id renewals. * If the current owner has been dead long enough we can assume that * its watchdog has triggered and we can go for the paxos lease.