src/paxos_lease.c

David Teigland teigland at fedoraproject.org
Wed Aug 15 17:26:40 UTC 2012


 src/paxos_lease.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit 73184e5785857e7c759e219efd361c0fceec090e
Author: David Teigland <teigland at redhat.com>
Date:   Wed Aug 15 12:20:33 2012 -0500

    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 <teigland at redhat.com>

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.




More information about the sanlock-devel mailing list