]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: pin request->target when target dentry is not pinned 4653/head
authorYan, Zheng <zyan@redhat.com>
Tue, 12 May 2015 09:06:46 +0000 (17:06 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 13 May 2015 03:24:50 +0000 (11:24 +0800)
In most cases, target dentry is pinned by request, so no one will
free the target inode. But for LOOKUP and LOOKUPPARENT requests,
target dentry is not pinned. So we should pin the target inode

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

index e18c77c728abc4024c96a24e56b2a4792a32d55a..f3a731838b9ba181fd8b52311f3a56b480ab9fed 100644 (file)
@@ -1210,9 +1210,15 @@ Inode* Client::insert_trace(MetaRequest *request, MetaSession *session)
     }
   }
 
-  if (in && (reply->head.op == CEPH_MDS_OP_READDIR ||
-            reply->head.op == CEPH_MDS_OP_LSSNAP)) {
-    insert_readdir_results(request, session, in);
+  if (in) {
+    if (reply->head.op == CEPH_MDS_OP_READDIR ||
+       reply->head.op == CEPH_MDS_OP_LSSNAP)
+      insert_readdir_results(request, session, in);
+
+    if (request->dentry() == NULL && in != request->inode()) {
+      // pin the target inode if its parent dentry is not pinned
+      request->set_other_inode(in);
+    }
   }
 
   request->target = in;