]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: handle this log replay error better:
authorGreg Farnum <gregf@hq.newdream.net>
Wed, 28 Jul 2010 18:54:40 +0000 (11:54 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Wed, 28 Jul 2010 18:55:12 +0000 (11:55 -0700)
Log it to the central log so it gets noticed, and
delete the "wrong inode" instead of just unlinking it, to prevent later crashiness.

Should at least band-aid over #312.

src/mds/journal.cc

index 32ede9f1163c8030ffc2421890e80a9cec2392de..ec2013dda5ac11a5120bbd040eeb2998118cff10 100644 (file)
@@ -479,13 +479,19 @@ void EMetaBlob::replay(MDS *mds, LogSegment *logseg)
        if (in->inode.is_symlink()) in->symlink = p->symlink;
        mds->mdcache->add_inode(in);
        if (!dn->get_linkage()->is_null()) {
-         if (dn->get_linkage()->is_primary())
-           dout(-10) << "EMetaBlob.replay FIXME had dentry linked to wrong inode " << *dn 
-                    << " " << *dn->get_linkage()->get_inode()
-                    << " should be " << p->inode.ino
-                    << dendl;
-         dir->unlink_inode(dn);
-         //assert(0); // hrm!  fallout from sloppy unlink?  or?  hmmm FIXME investigate further
+         if (dn->get_linkage()->is_primary()) {
+           CInode *old_in = dn->get_linkage()->get_inode();
+           stringstream ss;
+           ss << "EMetaBlob.replay FIXME had dentry linked to wrong inode " << *dn
+               << " " << *old_in
+               << " should be " << p->inode.ino;
+           dout(-10) << ss << dendl;
+           mds->logclient.log(LOG_WARN, ss);
+           dir->unlink_inode(dn);
+           mds->mdcache->remove_inode(old_in);
+
+           //assert(0); // hrm!  fallout from sloppy unlink?  or?  hmmm FIXME investigate further
+         }
        }
        dir->link_primary_inode(dn, in);
        if (p->dirty) in->_mark_dirty(logseg);