]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: delay processing cache expire when state >= EXPORT_EXPORTING
authorYan, Zheng <zheng.z.yan@intel.com>
Mon, 10 Dec 2012 02:06:28 +0000 (10:06 +0800)
committerSage Weil <sage@inktank.com>
Mon, 24 Dec 2012 04:01:12 +0000 (20:01 -0800)
It's possible that MDS receives cache expire in EXPORT_LOGGINGFINISH
and EXPORT_NOTIFYING states.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
src/mds/MDCache.cc
src/mds/Migrator.h

index f28f13b460db2efb5f6f72caf779924fbf302964..79fc0da25d941cfb9d8995bf32fb06bc98289e05 100644 (file)
@@ -5919,12 +5919,22 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
       assert(expired_inode);  // we had better have this.
       CDir *parent_dir = expired_inode->get_approx_dirfrag(p->first.frag);
       assert(parent_dir);
-      
+
+      int export_state = -1;
+      if (parent_dir->is_auth() && parent_dir->is_exporting()) {
+       export_state = migrator->get_export_state(parent_dir);
+       assert(export_state >= 0);
+      }
+
       if (!parent_dir->is_auth() ||
-         (parent_dir->is_auth() && parent_dir->is_exporting() &&
-          ((migrator->get_export_state(parent_dir) == Migrator::EXPORT_WARNING &&
+         (export_state != -1 &&
+          ((export_state == Migrator::EXPORT_WARNING &&
             migrator->export_has_warned(parent_dir,from)) ||
-           migrator->get_export_state(parent_dir) == Migrator::EXPORT_EXPORTING))) {
+           export_state == Migrator::EXPORT_EXPORTING ||
+           export_state == Migrator::EXPORT_LOGGINGFINISH ||
+           (export_state == Migrator::EXPORT_NOTIFYING &&
+            !migrator->export_has_notified(parent_dir,from))))) {
+
        // not auth.
        dout(7) << "delaying nonauth|warned expires for " << *parent_dir << dendl;
        assert(parent_dir->is_frozen_tree_root());
@@ -5937,10 +5947,9 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
        delayed_expire[parent_dir][from]->add_realm(p->first, p->second);
        continue;
       }
-      assert(!(parent_dir->is_auth() && parent_dir->is_exporting()) ||
-            migrator->get_export_state(parent_dir) <= Migrator::EXPORT_PREPPING ||
-             (migrator->get_export_state(parent_dir) == Migrator::EXPORT_WARNING &&
-                 !migrator->export_has_warned(parent_dir, from)));
+      assert(export_state <= Migrator::EXPORT_PREPPING ||
+             (export_state == Migrator::EXPORT_WARNING &&
+              !migrator->export_has_warned(parent_dir, from)));
 
       dout(7) << "expires for " << *parent_dir << dendl;
     } else {
index 7827667b208d20802658b69c0c20b508e281df5a..7988f325ff13269b582dd467202c9ab55022cd30 100644 (file)
@@ -176,8 +176,11 @@ public:
     return (export_warning_ack_waiting[dir].count(who) == 0);
   }
 
-
-
+  bool export_has_notified(CDir *dir, int who) {
+    assert(is_exporting(dir));
+    assert(export_state[dir] == EXPORT_NOTIFYING);
+    return (export_notify_ack_waiting[dir].count(who) == 0);
+  }
   // -- misc --
   void handle_mds_failure_or_stop(int who);