*/
in->oldest_snap = oldest_snap;
in->decode_snap_blob(snapbl);
+
+ /*
+ * In case there was anything malformed in the journal that we are
+ * replaying, do sanity checks on the inodes we're replaying and
+ * go damaged instead of letting any trash into a live cache
+ */
+ if (in->is_file()) {
+ // Files must have valid layouts with a pool set
+ if (in->inode.layout.pool_id == -1 || !in->inode.layout.is_valid()) {
+ dout(0) << "EMetaBlob.replay invalid layout on ino " << *in
+ << ": " << in->inode.layout << dendl;
+ std::ostringstream oss;
+ oss << "Invalid layout for inode 0x" << std::hex << in->inode.ino
+ << std::dec << " in journal";
+ mds->clog->error() << oss.str();
+ mds->damaged();
+ assert(0); // Should be unreachable because damaged() calls respawn()
+ }
+ }
}
// EMetaBlob::remotebit