From 3d3d85d8455fdb8e6f0230d03f10d0c1ec9c4427 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Fri, 15 Mar 2013 13:09:34 +0800 Subject: [PATCH] mds: don't replicate purging dentry 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 Reviewed-by: Greg Farnum --- src/mds/MDCache.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 78cf4f5600d62..0e2ab7fdcca79 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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); -- 2.39.5