]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
some more client fixes
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 13 Aug 2007 04:53:18 +0000 (04:53 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 13 Aug 2007 04:53:18 +0000 (04:53 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1626 29311d96-e01e-0410-9327-a35deaab8ce9

branches/sage/mds/client/Client.cc
branches/sage/mds/mds/Locker.cc
branches/sage/mds/mds/Server.cc
branches/sage/mds/mon/MDSMonitor.cc

index 792aae64350619ad7718004fd661d095c14e7058..8a633e5a40013ae7fbf1bd1c47eb060fe36ad5f9 100644 (file)
@@ -1625,6 +1625,8 @@ int Client::_rename(const char *from, const char *to)
   delete reply;
   dout(10) << "rename result is " << res << endl;
 
+  // renamed item from our cache
+
   trim_cache();
   dout(3) << "rename(\"" << from << "\", \"" << to << "\") = " << res << endl;
   return res;
@@ -3269,8 +3271,6 @@ int Client::ll_lookup(inodeno_t parent, const char *name, struct stat *attr)
     Inode *in = diri->dir->dentries[dname]->inode;
     fill_stat(in, attr);
     _ll_get(in);
-    dout(3) << "ll_lookup " << parent << " " << name << " -> " << in->inode.ino
-           << " (" << in << ")" << endl;
     assert(inode_map[in->inode.ino] == in);
   } else {
     r = -ENOENT;
@@ -3421,12 +3421,15 @@ int Client::ll_readlink(inodeno_t ino, const char **value)
   tout << ino.val << endl;
 
   Inode *in = _ll_get_inode(ino);
+  int r = 0;
   if (in->inode.is_symlink()) {
     *value = in->symlink->c_str();
-    return 0;
   } else {
-    return -EINVAL;
+    *value = "";
+    r = -EINVAL;
   }
+  dout(3) << "ll_readlink " << ino << " = " << r << " (" << *value << ")" << endl;
+  return r;
 }
 
 int Client::ll_mknod(inodeno_t parent, const char *name, mode_t mode, dev_t rdev, struct stat *attr)
index f9f0501e559a0726295802946ec34c335b0ac5e7..ea87fe8569b0bbc06271fbb0459ae393dceb3951 100644 (file)
@@ -469,7 +469,7 @@ Capability* Locker::issue_new_caps(CInode *in,
     cap->set_suppress(true);
   } else {
     // make sure it has sufficient caps
-    if (cap->wanted() & ~my_want) {
+    if (my_want & ~cap->wanted()) {
       // augment wanted caps for this client
       cap->set_wanted( cap->wanted() | my_want );
     }
@@ -679,8 +679,21 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
           << endl;  
   
   // update wanted
-  if (cap->wanted() != wanted)
-    cap->set_wanted(wanted);
+  if (cap->wanted() != wanted) {
+    if (m->get_seq() < cap->get_last_seq()) {
+      /* this is awkward.
+        client may be trying to release caps (i.e. inode closed, etc.) by setting reducing wanted
+        set.
+        but it may also be opening the same filename, not sure that it'll map to the same inode.
+        so, we don't want wanted reductions to clobber mds's notion of wanted unless we're
+        sure the client has seen all the latest caps.
+      */
+      dout(-10) << "handle_client_file_caps ignoring wanted " << cap_string(m->get_wanted())
+               << " bc seq " << m->get_seq() << " < " << cap->get_last_seq() << endl;
+    } else {
+      cap->set_wanted(wanted);
+    }
+  }
 
   // confirm caps
   int had = cap->confirm_receipt(m->get_seq(), m->get_caps());
index bd9d7f225bb33b500c95faf8de68edb2753a05b9..f37ace7f30488924bdfd82b45d8df5b883b5656d 100644 (file)
@@ -2885,7 +2885,7 @@ void Server::_rename_finish(MDRequest *mdr, CDentry *srcdn, CDentry *destdn, CDe
 
   // reply
   MClientReply *reply = new MClientReply(mdr->client_request, 0);
-  reply_request(mdr, reply, destdn->dir->get_inode());  // FIXME: imprecise ref
+  reply_request(mdr, reply, destdn->get_inode());  // FIXME: imprecise ref
   
   // clean up?
   if (straydn) 
index abe37c40d4ddadbf4041eed5de42e6de721cbee7..f4ded2330d20ed344e045500c580f5bd5c45c661 100644 (file)
@@ -556,9 +556,28 @@ void MDSMonitor::do_stop()
   print_map(mdsmap);
   for (map<int,int>::iterator p = mdsmap.mds_state.begin();
        p != mdsmap.mds_state.end();
-       ++p) 
-    if (mdsmap.is_active(p->first))
+       ++p) {
+    switch (p->second) {
+    case MDSMap::STATE_ACTIVE:
+    case MDSMap::STATE_STOPPING:
       pending_mdsmap.mds_state[p->first] = MDSMap::STATE_STOPPING;
+      break;
+    case MDSMap::STATE_CREATING:
+    case MDSMap::STATE_STANDBY:
+      pending_mdsmap.mds_state[p->first] = MDSMap::STATE_DNE;
+      break;
+    case MDSMap::STATE_STARTING:
+      pending_mdsmap.mds_state[p->first] = MDSMap::STATE_STOPPED;
+      break;
+    case MDSMap::STATE_REPLAY:
+    case MDSMap::STATE_RESOLVE:
+    case MDSMap::STATE_RECONNECT:
+    case MDSMap::STATE_REJOIN:
+      // BUG: hrm, if this is the case, the STOPPING gusy won't be able to stop, will they?
+      pending_mdsmap.mds_state[p->first] = MDSMap::STATE_FAILED;
+      break;
+    }
+  }
 
   propose_pending();
 }