]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't add setfilelock requests to session's completed_requests 4743/head
authorYan, Zheng <zyan@redhat.com>
Fri, 22 May 2015 01:47:44 +0000 (09:47 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 29 May 2015 01:45:04 +0000 (09:45 +0800)
setfilelock requests only modify states in MDS memory. The states get
lost when MDS fails. If a setfilelock reply gets lost when MDS fails,
client will re-send corresponding setfilelock request when new MDS
restarts. The new MDS should re-execute the setfilelock request

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/Server.cc

index 39a4465aa3318b55a02653a990cff6751c2e73d6..e069a457b854db4240a26730630d2a32dabfcb9c 100644 (file)
@@ -1078,7 +1078,13 @@ void Server::reply_client_request(MDRequestRef& mdr, MClientReply *reply)
   mdr->mark_event("replying");
 
   // note successful request in session map?
-  if (req->may_write() && mdr->session && reply->get_result() == 0) {
+  //
+  // setfilelock requests are special, they only modify states in MDS memory.
+  // The states get lost when MDS fails. If Client re-send a completed
+  // setfilelock request, it means that client did not receive corresponding
+  // setfilelock reply.  So MDS should re-execute the setfilelock request.
+  if (req->may_write() && req->get_op() != CEPH_MDS_OP_SETFILELOCK &&
+      reply->get_result() == 0 && mdr->session) {
     inodeno_t created = mdr->alloc_ino ? mdr->alloc_ino : mdr->used_prealloc_ino;
     mdr->session->add_completed_request(mdr->reqid.tid, created);
     if (mdr->ls) {