diff mbox

[38/39] mds: don't replicate purging dentry

Message ID 1363531902-24909-39-git-send-email-zheng.z.yan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yan, Zheng March 17, 2013, 2:51 p.m. UTC
From: "Yan, Zheng" <zheng.z.yan@intel.com>

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>
---
 src/mds/MDCache.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Gregory Farnum March 21, 2013, 3:46 a.m. UTC | #1
Reviewed-by: Greg Farnum <greg@inktank.com>

On Sun, Mar 17, 2013 at 7:51 AM, Yan, Zheng <zheng.z.yan@intel.com> wrote:
> From: "Yan, Zheng" <zheng.z.yan@intel.com>
>
> 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>
> ---
>  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 24f1109..d730ff1 100644
> --- a/src/mds/MDCache.cc
> +++ b/src/mds/MDCache.cc
> @@ -9225,8 +9225,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);
> --
> 1.7.11.7
>
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index 24f1109..d730ff1 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -9225,8 +9225,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);