} else if (read_result != 0) {
mds->clog->error() << "failed to read JournalPointer: " << read_result
<< " (" << cpp_strerror(read_result) << ")";
- mds->mds_lock.Lock();
- mds->damaged();
- mds->mds_lock.Unlock();
+ mds->damaged_unlocked();
assert(0); // Should be unreachable because damaged() calls respawn()
}
// means something worse like a corrupt header, which we can't handle here.
mds->clog->error() << "Error recovering journal " << jp.front << ": "
<< cpp_strerror(recovery_result);
- mds->mds_lock.Lock();
- mds->damaged();
- mds->mds_lock.Unlock();
+ mds->damaged_unlocked();
assert(recovery_result == 0); // Unreachable because damaged() calls respawn()
}
if (recovery_result != 0) {
mds->clog->error() << "Error recovering journal " << jp.front << ": "
<< cpp_strerror(recovery_result);
- mds->mds_lock.Lock();
- mds->damaged();
- mds->mds_lock.Unlock();
+ mds->damaged_unlocked();
assert(recovery_result == 0); // Unreachable because damaged() calls respawn()
}
r = -EAGAIN;
} else {
mds->clog->error() << "missing journal object";
- mds->mds_lock.Lock();
- mds->damaged();
- mds->mds_lock.Unlock();
+ mds->damaged_unlocked();
assert(0); // Should be unreachable because damaged() calls respawn()
}
} else if (r == -EINVAL) {
r = -EAGAIN;
} else {
mds->clog->error() << "invalid journaler offsets";
- mds->mds_lock.Lock();
- mds->damaged();
- mds->mds_lock.Unlock();
+ mds->damaged_unlocked();
assert(0); // Should be unreachable because damaged() calls respawn()
}
} else {
<< dendl;
mds->clog->error() << "error reading journal header";
- mds->mds_lock.Lock();
- mds->damaged();
- mds->mds_lock.Unlock();
+ mds->damaged_unlocked();
assert(0); // Should be unreachable because damaged() calls
// respawn()
}
if (g_conf->mds_log_skip_corrupt_events) {
continue;
} else {
- mds->mds_lock.Lock();
- mds->damaged();
- mds->mds_lock.Unlock();
+ mds->damaged_unlocked();
assert(0); // Should be unreachable because damaged() calls
// respawn()
}
* to load an MDS rank's data structures. This is *not* for use with
* errors affecting normal dirfrag/inode objects -- they should be handled
* through cleaner scrub/repair mechanisms.
+ *
+ * Callers must already hold mds_lock.
*/
void damaged();
+ /**
+ * Wrapper around `damaged` for users who are not
+ * already holding mds_lock.
+ *
+ * Callers must not already hold mds_lock.
+ */
+ void damaged_unlocked()
+ {
+ Mutex::Locker l(mds_lock);
+ damaged();
+ }
+
/**
* Terminate this daemon process.
*