]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: send any dirty scatterlock state on rejoin
authorSage Weil <sage@newdream.net>
Wed, 6 Apr 2011 22:09:39 +0000 (15:09 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Tue, 12 Apr 2011 18:12:56 +0000 (11:12 -0700)
Not just inodes for auth dirfrags, but for any inode with dirty scatterlock
state.  Include the root inode.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/CInode.cc
src/mds/CInode.h
src/mds/MDCache.cc
src/mds/ScatterLock.h

index 0e0829a894e03251eab845077f354f0b92fb6241..4f29103f7074778b253006f6f85ffa255e2917f9 100644 (file)
@@ -1512,11 +1512,11 @@ bool CInode::is_dirty_scattered()
     dirfragtreelock.is_dirty_or_flushing();
 }
 
-void CInode::fail_scatter_flush()
+void CInode::finish_scatter_flushes()
 {
-  filelock.fail_flush();
-  nestlock.fail_flush();
-  dirfragtreelock.fail_flush();
+  filelock.finish_flush();
+  nestlock.finish_flush();
+  dirfragtreelock.finish_flush();
 }
 
 void CInode::clear_dirty_scattered(int type)
index 92c413d45f4601bcb518cacdc625ab2527e4c618..e5746ef9d4e18c75b4bb6826f5b1473fa8401193 100644 (file)
@@ -727,7 +727,7 @@ public:
 
   void clear_dirty_scattered(int type);
   bool is_dirty_scattered();
-  void fail_scatter_flush();
+  void finish_scatter_flushes();  // on rejoin ack
 
   void start_scatter(ScatterLock *lock);
   void finish_scatter_update(ScatterLock *lock, CDir *dir,
index 3e01233c1e5c437f48ee1e4649a8d894020d1b60..d0130bc88b434e79cabac1caf0119054c7147fc5 100644 (file)
@@ -3091,18 +3091,8 @@ void MDCache::rejoin_send_rejoins()
     assert(!dir->is_ambiguous_dir_auth());
 
     // my subtree?
-    if (dir->is_auth()) {
-      // include scatterlock state with parent inode's subtree?
-      if (dir->inode->is_dirty_scattered()) {
-       dir->inode->fail_scatter_flush();  // flushing -> dirty for these locks
-       int inauth = dir->inode->authority().first;
-       if (rejoins.count(inauth)) {
-         dout(10) << " sending scatterlock state to mds" << inauth << " for " << *dir << dendl;
-         rejoins[inauth]->add_scatterlock_state(dir->inode);
-       }
-      }
+    if (dir->is_auth())
       continue;  // skip my own regions!
-    }
 
     int auth = dir->get_dir_auth().first;
     assert(auth >= 0);
@@ -3118,8 +3108,13 @@ void MDCache::rejoin_send_rejoins()
        ++p) {
     if (mds->is_rejoin()) {
       // weak
-      if (p->first == 0 && root) 
+      if (p->first == 0 && root) {
        p->second->add_weak_inode(root->vino());
+       if (root->is_dirty_scattered()) {
+         dout(10) << " sending scatterlock state on root " << *root << dendl;
+         p->second->add_scatterlock_state(root);
+       }
+      }
       for (int i = 0; i < NUM_STRAY; ++i) {
        CInode *s = get_inode(MDS_INO_STRAY(p->first, i)); 
        if (s)
@@ -3134,6 +3129,10 @@ void MDCache::rejoin_send_rejoins()
                                    root->filelock.get_state(),
                                    root->nestlock.get_state(),
                                    root->dirfragtreelock.get_state());
+       if (root->is_dirty_scattered()) {
+         dout(10) << " sending scatterlock state on root " << *root << dendl;
+         p->second->add_scatterlock_state(root);
+       }
       }
       for (int i = 0; i < NUM_STRAY; ++i) {
        if (CInode *in = get_inode(MDS_INO_STRAY(p->first, i))) {
@@ -3248,6 +3247,10 @@ void MDCache::rejoin_walk(CDir *dir, MMDSCacheRejoin *rejoin)
       assert(dnl->get_inode()->is_dir());
       rejoin->add_weak_primary_dentry(dir->ino(), dn->name.c_str(), dn->first, dn->last, in->ino());
       in->get_nested_dirfrags(nested);
+      if (in->is_dirty_scattered()) {
+       dout(10) << " sending scatterlock state" << dendl;
+       rejoin->add_scatterlock_state(in);
+      }
     }
   } else {
     // STRONG
@@ -3275,6 +3278,10 @@ void MDCache::rejoin_walk(CDir *dir, MMDSCacheRejoin *rejoin)
                                 in->nestlock.get_state(),
                                 in->dirfragtreelock.get_state());
        in->get_nested_dirfrags(nested);
+       if (in->is_dirty_scattered()) {
+         dout(10) << " sending scatterlock state" << dendl;
+         rejoin->add_scatterlock_state(in);
+       }
       }
     }
   }
index bc4398a65ee4bb9bbbfafc05ad0eb5159a125aa8..9afd21a8dd439f6b73b75f29536dcddb1a61d9b8 100644 (file)
@@ -141,12 +141,6 @@ public:
       try_clear_more();
     }
   }
-  void fail_flush() {
-    if (is_flushing()) {
-      _more->dirty = true;
-      _more->flushing = false;
-    }
-  }
   void clear_dirty() {
     start_flush();
     finish_flush();