]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: allow snaps in root dir. This may be too large a stick, though
authorGreg Farnum <gregf@hq.newdream.net>
Wed, 11 Aug 2010 15:58:58 +0000 (08:58 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 19 Aug 2010 22:33:54 +0000 (15:33 -0700)
src/mds/AnchorServer.cc
src/mds/MDCache.cc
src/mds/Server.cc
src/mds/events/EMetaBlob.h

index e1a3e1189bb217eb907420aa3a4427a83fc3c9b5..1db28e87eac3a09234c3a426321dc50f893e35da 100644 (file)
@@ -80,7 +80,7 @@ void AnchorServer::inc(inodeno_t ino)
     dout(10) << "inc now " << anchor << dendl;
     ino = anchor.dirino;
     
-    if (ino == 0) break;
+    if (ino == 0 || MDS_INO_IS_BASE(ino)) break;
     if (anchor_map.count(ino) == 0) break;
   }
 }
@@ -128,8 +128,11 @@ void AnchorServer::_prepare(bufferlist &bl, uint64_t reqid, int bymds)
     version++;
 
     // make sure trace is in table
-    for (unsigned i=0; i<trace.size(); i++) 
+    dout(0) << "trace.size=" << trace.size() << dendl;
+    for (unsigned i=0; i<trace.size(); i++) {
       add(trace[i].ino, trace[i].dirino, trace[i].dn_hash);
+      dout(0) << trace[i] << dendl;
+    }
     inc(ino);
     pending_create[version] = ino;  // so we can undo
     break;
index fd3366ed64dd2e1c931b1e60d7483fb55cacae2a..81b45d262b1ad275561857dcb936ab19a18dc22d 100644 (file)
@@ -246,6 +246,7 @@ void MDCache::init_layouts()
 
 CInode *MDCache::create_system_inode(inodeno_t ino, int mode)
 {
+  dout(0) << "creating system inode with ino:" << ino << dendl;
   CInode *in = new CInode(this);
   in->inode.ino = ino;
   in->inode.version = 1;
@@ -1302,6 +1303,10 @@ CInode *MDCache::cow_inode(CInode *in, snapid_t last)
 void MDCache::journal_cow_dentry(Mutation *mut, EMetaBlob *metablob, CDentry *dn, snapid_t follows,
                                 CInode **pcow_inode, CDentry::linkage_t *dnl)
 {
+  if (!dn) {
+    dout(10) << "journal_cow_dentry got null CDentry, returning" << dendl;
+    return;
+  }
   dout(10) << "journal_cow_dentry follows " << follows << " on " << *dn << dendl;
 
   // nothing to cow on a null dentry, fix caller
@@ -6667,6 +6672,10 @@ void MDCache::anchor_create(MDRequest *mdr, CInode *in, Context *onfinish)
   // make trace
   vector<Anchor> trace;
   in->make_anchor_trace(trace);
+  if (!trace.size()) {
+    assert(MDS_INO_IS_BASE(in->ino()));
+    trace.push_back(Anchor(in->ino(), in->ino(), "", 0, 0));
+  }
   
   // do it
   C_MDC_AnchorPrepared *fin = new C_MDC_AnchorPrepared(this, in, true);
index 7743e2dc9cc7a2947fbd99d2c4450f0381111d13..b0598a3f8f83fd19ae19147ffd913f8f4e256edd 100644 (file)
@@ -5619,7 +5619,8 @@ struct C_MDS_mksnap_finish : public Context {
 void Server::handle_client_mksnap(MDRequest *mdr)
 {
   MClientRequest *req = mdr->client_request;
-
+  dout(0) << "making snap with filepath: " << req->get_filepath().c_str()
+          << " and ino:" << req->get_filepath().get_ino() << dendl;
   CInode *diri = mdcache->get_inode(req->get_filepath().get_ino());
   if (!diri || diri->state_test(CInode::STATE_PURGING)) {
     reply_request(mdr, -ESTALE);
@@ -5636,10 +5637,10 @@ void Server::handle_client_mksnap(MDRequest *mdr)
     reply_request(mdr, -ENOTDIR);
     return;
   }
-  if (diri->is_system()) {  // no snaps on root dir, at least not until we can store it
+/*  if (diri->is_system()) {  // no snaps on root dir, at least not until we can store it
     reply_request(mdr, -EPERM);
     return;
-  }
+  }*/
 
   const string &snapname = req->get_filepath().last_dentry();
   dout(10) << "mksnap " << snapname << " on " << *diri << dendl;
index fd65d1c58ea70cc48c325cca0c4f7e3b69ed6bc6..dc6af797d5840bf20a1170300ef6bc4ac912648b 100644 (file)
@@ -507,8 +507,10 @@ private:
   inode_t *add_primary_dentry(CDentry *dn, bool dirty, 
                              CInode *in=0, fragtree_t *pdft=0, bufferlist *psnapbl=0,
                              map<string,bufferptr> *px=0) {
-    return add_primary_dentry(add_dir(dn->get_dir(), false),
+    if (dn)
+      return add_primary_dentry(add_dir(dn->get_dir(), false),
                              dn, dirty, in, pdft, psnapbl, px);
+    else return NULL;
   }
   inode_t *add_primary_dentry(dirlump& lump, CDentry *dn, bool dirty, 
                              CInode *in=0, fragtree_t *pdft=0, bufferlist *psnapbl=0,