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;
}
}
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;
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;
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
// 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);
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);
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;
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,