]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't replicate purging dentry
authorYan, Zheng <zheng.z.yan@intel.com>
Fri, 15 Mar 2013 05:09:34 +0000 (13:09 +0800)
committerGreg Farnum <greg@inktank.com>
Mon, 1 Apr 2013 16:26:24 +0000 (09:26 -0700)
open_remote_ino is racy, it's possible someone deletes the inode's
last linkage while the MDS is discovering the inode.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/mds/MDCache.cc

index 78cf4f5600d62f2aa977d402b06d20068d917de9..0e2ab7fdcca7904d43b809a0787e748af1bd299d 100644 (file)
@@ -9288,8 +9288,15 @@ void MDCache::handle_discover(MDiscover *dis)
     if (dis->get_want_ino()) {
       // lookup by ino
       CInode *in = get_inode(dis->get_want_ino(), snapid);
-      if (in && in->is_auth() && in->get_parent_dn()->get_dir() == curdir)
+      if (in && in->is_auth() && in->get_parent_dn()->get_dir() == curdir) {
        dn = in->get_parent_dn();
+       if (dn->state_test(CDentry::STATE_PURGING)) {
+         // set error flag in reply
+         dout(7) << "dentry " << *dn << " is purging, flagging error ino" << dendl;
+         reply->set_flag_error_ino();
+         break;
+       }
+      }
     } else if (dis->get_want().depth() > 0) {
       // lookup dentry
       dn = curdir->lookup(dis->get_dentry(i), snapid);