]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
*** empty log message ***
authorsage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Wed, 11 Aug 2004 22:03:47 +0000 (22:03 +0000)
committersage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Wed, 11 Aug 2004 22:03:47 +0000 (22:03 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@85 29311d96-e01e-0410-9327-a35deaab8ce9

ceph/client/Client.cc
ceph/config.cc
ceph/mds/CDir.cc
ceph/mds/CInode.cc
ceph/mds/MDCache.cc
ceph/mds/MDCache.h
ceph/mds/MDS.cc
ceph/mds/MDStore.cc
ceph/mds/events/EInodeUpdate.h
ceph/script/find_waiters.pl
ceph/test/fakemds.cc

index 25ffae54aaf66c44f58129aebb5cb10a2cd870c9..a475eded950021468ac30b7c44b42b03e2c2585c 100644 (file)
@@ -335,7 +335,7 @@ void Client::issue_request()
        if (cwd) {  // stat root if we don't have it.
          if (r < 10)
                op = MDS_OP_TOUCH;
-         else if (false && r < 11) 
+         else if (r < 11) 
                op = MDS_OP_CHMOD;
          else if (r < 20 && !is_open(cwd) && !cwd->isdir) 
                op = MDS_OP_OPENRD;
index e7428fcbbf2baa23433cc04c92605c27b555d64e..844478c184daf3e323c3c2786ec8506fd185c921 100644 (file)
@@ -34,7 +34,7 @@ md_config_t g_conf = {
   mdcache_mid: .8,
   mdcache_sticky_sync_normal: true,
   mdcache_sticky_sync_softasync: false,
-  mdcache_sticky_lock: false,   // sticky probably a bad idea
+  mdcache_sticky_lock: false,       // sticky is probably a bad idea!
 
   mdbal_replicate_threshold: 500,
   mdbal_unreplicate_threshold: 200,
index cb8210deb6e9fd0ad63ace279fd3abe4f4088edb..bf21640ccf9efbf7fe0ae3aecead87d518957b5b 100644 (file)
@@ -191,7 +191,7 @@ void CDir::take_waiting(int mask,
          dout(10) << "take_waiting dentry " << dentry << " mask " << mask << " took " << it->second << " tag " << it->first << " on dir " << *inode << endl;
          waiting_on_dentry[dentry].erase(it++);
        } else {
-         dout(10) << "take_waiting dentry " << dentry << " SKIPPING mask " << mask << " took " << it->second << " tag " << it->first << " on dir " << *inode << endl;
+         dout(10) << "take_waiting dentry " << dentry << " mask " << mask << " SKIPPING " << it->second << " tag " << it->first << " on dir " << *inode << endl;
          it++;
        }
   }
@@ -214,7 +214,7 @@ void CDir::take_waiting(int mask,
        hash_map<string, multimap<int,Context*> >::iterator it = 
          it = waiting_on_dentry.begin(); 
        while (it != waiting_on_dentry.end()) {
-         take_waiting(mask, it->first, ls);
+         take_waiting(mask, (it++)->first, ls);   // not post-inc
        }
   }
   
@@ -244,7 +244,7 @@ void CDir::take_waiting(int mask,
 void CDir::auth_pin() {
   inode->get(CINODE_PIN_DAUTHPIN + auth_pins);
   auth_pins++;
-  dout(7) << "auth_unpin on " << *inode << " count now " << auth_pins << endl;
+  dout(7) << "auth_pin on dir " << *inode << " count now " << auth_pins << " + " << nested_auth_pins << endl;
   inode->adjust_nested_auth_pins( 1 );
 }
 
@@ -252,7 +252,7 @@ void CDir::auth_unpin() {
   auth_pins--;
   inode->put(CINODE_PIN_DAUTHPIN + auth_pins);
   assert(auth_pins >= 0);
-  dout(7) << "auth_unpin on " << *inode << " count now " << auth_pins << endl;
+  dout(7) << "auth_unpin on dir " << *inode << " count now " << auth_pins << " + " << nested_auth_pins << endl;
 
   // pending freeze?
   if (auth_pins + nested_auth_pins == 0) {
@@ -268,6 +268,8 @@ void CDir::auth_unpin() {
 int CDir::adjust_nested_auth_pins(int a) {
   nested_auth_pins += a;
 
+  dout(11) << "adjust_nested_auth_pins on dir " << *inode << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+
   // pending freeze?
   if (auth_pins + nested_auth_pins == 0) {
        list<Context*> waiting_to_freeze;
index 10f12f3b86aa0fbd2563402a9c8f374e5270f41d..7096e787911fff7fd60453816011799b5f64ec67 100644 (file)
@@ -203,6 +203,7 @@ void CInode::take_waiting(int mask, list<Context*>& ls)
 // auth_pins
 int CInode::adjust_nested_auth_pins(int a) {
   nested_auth_pins += a;
+  dout(11) << "adjust_nested_auth_pins on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
   if (parent) 
        parent->dir->adjust_nested_auth_pins(a);
 }
@@ -216,12 +217,14 @@ bool CInode::can_auth_pin() {
 void CInode::auth_pin() {
   get(CINODE_PIN_IAUTHPIN + auth_pins);
   auth_pins++;
+  dout(7) << "auth_pin on inode " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
   if (parent)
        parent->dir->adjust_nested_auth_pins( 1 );
 }
 
 void CInode::auth_unpin() {
   auth_pins--;
+  dout(7) << "auth_unpin on inode " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
   put(CINODE_PIN_IAUTHPIN + auth_pins);
   if (parent)
        parent->dir->adjust_nested_auth_pins( -1 );
index ec9c74a7c1406556d47a318fcbf210befdc8013b..f09b46defda214cd0eb5242f862b27a1c26b6ca2 100644 (file)
@@ -170,6 +170,27 @@ bool MDCache::trim(__int32_t max) {
 }
 
 
+void MDCache::shutdown_start()
+{
+  dout(1) << "unsync, unlock everything" << endl;
+
+  // walk cache
+  bool didsomething = false;
+  for (hash_map<inodeno_t, CInode*>::iterator it = inode_map.begin();
+          it != inode_map.end();
+          it++) {
+       CInode *in = it->second;
+       if (in->is_auth()) {
+         if (in->is_syncbyme()) sync_release(in);
+         if (in->is_lockbyme()) inode_lock_release(in);
+       }
+  }
+
+  // make sure sticky sync is off
+  g_conf.mdcache_sticky_sync_normal = false;
+
+}
+
 bool MDCache::shutdown_pass()
 {
   static bool did_inode_updates = false;
@@ -187,52 +208,46 @@ bool MDCache::shutdown_pass()
   
   if (mds->mdlog->get_num_events()) {
        dout(7) << "waiting for log to flush" << endl;
-  } else {
-       dout(7) << "log is empty; flushing cache" << endl;
-       trim(0);
+       return false;
+  } 
 
-       dout(7) << "walking remaining cache for loose ends" << endl;    
-       // walk cache
-       bool didsomething = false;
-       for (hash_map<inodeno_t, CInode*>::iterator it = inode_map.begin();
-                it != inode_map.end();
-                it++) {
-         CInode *in = it->second;
-         if (in->is_auth()) {
-               // cached_by
-               // unpin inodes on shut down nodes.
-               // NOTE: this happens when they expire during an export; expires reference inodes, and can thus
-               // be missed.
-               if (mds->get_nodeid() == 0 &&
-                       in->is_cached_by_anyone()) {
-                 for (set<int>::iterator by = in->cached_by.begin();
-                          by != in->cached_by.end();
-                          ) {
-                       int who = *by;
-                       by++;
-                       if (mds->is_shut_down(who)) {
-                         in->cached_by_remove(who);
-                         didsomething = true;
-                       }
+  dout(7) << "log is empty; flushing cache" << endl;
+  trim(0);
+  
+  // walk cache
+  dout(7) << "walking remaining cache for items cached_by shut down nodes" << endl;
+  bool didsomething = false;
+  for (hash_map<inodeno_t, CInode*>::iterator it = inode_map.begin();
+          it != inode_map.end();
+          it++) {
+       CInode *in = it->second;
+       if (in->is_auth()) {
+         // cached_by
+         // unpin inodes on shut down nodes.
+         // NOTE: this happens when they expire during an export; expires reference inodes, and can thus
+         // be missed.
+         if (mds->get_nodeid() == 0 &&
+                 in->is_cached_by_anyone()) {
+               for (set<int>::iterator by = in->cached_by.begin();
+                        by != in->cached_by.end();
+                        ) {
+                 int who = *by;
+                 by++;
+                 if (mds->is_shut_down(who)) {
+                       in->cached_by_remove(who);
+                       didsomething = true;
                  }
                }
-               
-               // sync, lock release
-               if (in->is_syncbyme()) 
-                 sync_release(in);
-               if (in->is_lockbyme()) 
-                 inode_lock_release(in);
          }
        }
-       if (didsomething)
-         trim(0);
-       
   }
-
+  if (didsomething)
+       trim(0);
+  
   dout(7) << "cache size now " << lru->lru_get_size() << endl;
 
   // send inode_expire's on all potentially cache pinned items
-  if (0 &&
+  if (false &&
          !did_inode_updates) {
        did_inode_updates = true;
 
@@ -258,7 +273,7 @@ bool MDCache::shutdown_pass()
          export_dir(im,0);
        }
   } else {
-       // shut down root
+       // shut down root?
        if (lru->lru_get_size() == 1) {
          // all i have left is root.. wtf?
          dout(7) << "wahoo, all i have left is root!" << endl;
index 863997ceed7c155f5adde2f97ffbe991d2cca2a7..3e8e093cca5ead08f7cfb562e532b0b700f79329 100644 (file)
@@ -80,8 +80,9 @@ class MDCache {
   }
   size_t get_cache_size() { lru->lru_get_size(); }
   bool trim(__int32_t max = -1);   // trim cache
-  bool shutdown_pass();
 
+  void shutdown_start();
+  bool shutdown_pass();
   bool shutdown();                    // clear cache (ie at shutodwn)
 
   // have_inode?
index 30fd2b648ae98c11cd9c9678b9321f5328c429ff..f2681027583c3171065840d64987cf0e0cf3a781 100644 (file)
@@ -135,6 +135,8 @@ void MDS::handle_shutdown_start(Message *m)
 
   // set flag
   shutting_down = true;
+
+  mdcache->shutdown_start();
   
   // flush log
   mdlog->set_max_events(0);
index 00cdf5382c0c22a2abce6e23c2ca27d32a67baee..89de750da66ad9eebd6ac208c869e0ddb547d064 100644 (file)
@@ -286,6 +286,7 @@ bool MDStore::commit_dir( CInode *in,
        dout(7) << "commit_dir " << *in << " can't auth_pin, waiting" << endl;
        in->dir->add_waiter(CDIR_WAIT_AUTHPINNABLE,
                                                new C_MDS_CommitDirDelay(mds, in->inode.ino, c) );
+       return false;
   }
 
 
index 8f3e2f78eb6bd94cd2c7ff794c401dcb73294443..5c5716195506245d6318ad2217e7667c0c3a5994 100644 (file)
@@ -82,10 +82,15 @@ class EInodeUpdate : public LogEvent {
          dout(7) << "inode " << inode.ino << " not in cache, must have exported" << endl;
          return true;
        }
-       if (in->authority(mds->get_cluster()) != mds->get_nodeid())
+       if (!in->is_auth())
          return true;  // not my inode anymore!
        if (in->get_version() != version)
          return true;  // i'm obsolete!  (another log entry follows)
+
+       // frozen -> exporting -> obsolete    (FOR NOW?)
+       if (in->is_frozen())
+         return true; 
+
        return false;  
   }
 
index 5647136e1493e9f4efa5eef35bce6a788ca24e15..d50a98e2eb925bb991a002e5f45cc4be3d1a06a7 100755 (executable)
@@ -2,6 +2,7 @@
 
 my %waiting;  # context => what where what is "inode ..." or "dir ..."
 my %hist;     # context => history since waited
+my @waiting;
 
 while (<>) {
        if (/add_waiter/) {
@@ -9,6 +10,7 @@ while (<>) {
 #              print "add_waiter $c $what\n";
                $waiting{$c} = $what;
                $hist{$c} .= $_;
+               push( @waiting, $c );
        }
        if (/take_waiting/) {
                if (/SKIPPING/) {
@@ -18,15 +20,15 @@ while (<>) {
                        my ($c) = /took (0x\w+)/;
                        delete $waiting{$c};
                        delete $hist{$c};
+                       @waiting = grep {$_ ne $c} @waiting;
                } else {
                        die "i don't understand: $_";
                }
        }
 }
 
-for my $c (keys %waiting) {
+for my $c (@waiting) {
        print "---- lost waiter $c $waiting{$c}
 $hist{$c}
-
 ";
 }
index 94c7470c1547541eac4e976e3b9d1ee1b9c8d6e7..cf9d177657adee342c3b1a2f91d2b13cfb31f7f1 100644 (file)
@@ -31,7 +31,7 @@ __uint64_t ino = 1;
 int play();
 
 int main(int argc, char **argv) {
-  cout << "hi there" << endl;
+  cerr << "hi there" << endl;
   
   MDCluster *mdc = new MDCluster(NUMMDS, NUMOSD);