]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix corrupt CInode handling
authorJohn Spray <john.spray@redhat.com>
Tue, 19 May 2015 10:59:57 +0000 (11:59 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 18 Jun 2015 10:19:44 +0000 (11:19 +0100)
Were previously catching errors from InodeStore but
not the leading magic.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/CInode.cc

index a16b8cabe6b236f4a924a82abae86f3c769d393c..878b957da3f7cb5456a169149393dadf58abc9b6 100644 (file)
@@ -1057,24 +1057,27 @@ void CInode::_fetched(bufferlist& bl, bufferlist& bl2, Context *fin)
     fin->complete(-ENOENT);
     return;
   }
-  string magic;
-  ::decode(magic, p);
-  dout(10) << " magic is '" << magic << "' (expecting '" << CEPH_FS_ONDISK_MAGIC << "')" << dendl;
-  if (magic != CEPH_FS_ONDISK_MAGIC) {
-    dout(0) << "on disk magic '" << magic << "' != my magic '" << CEPH_FS_ONDISK_MAGIC
-           << "'" << dendl;
-    fin->complete(-EINVAL);
-  } else {
-    try {
-      decode_store(p);
-    } catch (buffer::error &err) {
-      derr << "Corrupt inode 0x" << std::hex << ino() << std::dec
-        << ": " << err << dendl;
+
+  // Attempt decode
+  try {
+    string magic;
+    ::decode(magic, p);
+    dout(10) << " magic is '" << magic << "' (expecting '"
+             << CEPH_FS_ONDISK_MAGIC << "')" << dendl;
+    if (magic != CEPH_FS_ONDISK_MAGIC) {
+      dout(0) << "on disk magic '" << magic << "' != my magic '" << CEPH_FS_ONDISK_MAGIC
+              << "'" << dendl;
       fin->complete(-EINVAL);
-      return;
+    } else {
+      decode_store(p);
+      dout(10) << "_fetched " << *this << dendl;
+      fin->complete(0);
     }
-    dout(10) << "_fetched " << *this << dendl;
-    fin->complete(0);
+  } catch (buffer::error &err) {
+    derr << "Corrupt inode 0x" << std::hex << ino() << std::dec
+      << ": " << err << dendl;
+    fin->complete(-EINVAL);
+    return;
   }
 }