From 58ce32cc84a82619108bf3496e0175b221b9e9a2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 30 Mar 2010 10:30:02 -0700 Subject: [PATCH] mds: fix MDSTableClient ack double journaling Do not journal ack unless the tid is registered in the LogSegment. Once we journal it, we remove it from the LogSegment list, and once it's journaled, we remove the pending_commit[tid] entry. This fixes a bug where the mds got two acks, journaled both of them, and crashed in the completion for the second because pending_commit[tid] was gone. The second ack should have been ignored. --- src/mds/MDSTableClient.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mds/MDSTableClient.cc b/src/mds/MDSTableClient.cc index 513b790146359..05c7944f4d1ba 100644 --- a/src/mds/MDSTableClient.cc +++ b/src/mds/MDSTableClient.cc @@ -85,7 +85,8 @@ void MDSTableClient::handle_request(class MMDSTableRequest *m) break; case TABLESERVER_OP_ACK: - if (pending_commit.count(tid)) { + if (pending_commit.count(tid) && + pending_commit[tid]->pending_commit_tids[table].count(tid)) { dout(10) << "got ack on tid " << tid << ", logging" << dendl; assert(g_conf.mds_kill_mdstable_at != 7); @@ -175,9 +176,10 @@ void MDSTableClient::got_journaled_agree(version_t tid, LogSegment *ls) void MDSTableClient::got_journaled_ack(version_t tid) { dout(10) << "got_journaled_ack " << tid << dendl; - if (pending_commit.count(tid)) + if (pending_commit.count(tid)) { pending_commit[tid]->pending_commit_tids[table].erase(tid); - pending_commit.erase(tid); + pending_commit.erase(tid); + } } void MDSTableClient::finish_recovery() -- 2.39.5