asok_hook,
"Config a CephFS client session");
assert(r == 0);
+ r = admin_socket->register_command("damage ls",
+ asok_hook,
+ "List detected metadata damage");
+ assert(r == 0);
+ r = admin_socket->register_command("damage rm "
+ "name=damage_id,type=CephInt",
+ asok_hook,
+ "Remove a damage table entry");
+ assert(r == 0);
r = admin_socket->register_command("osdmap barrier name=target_epoch,type=CephInt",
asok_hook,
"Wait until the MDS has this OSD map epoch");
const std::vector<MDSDaemon::MDSCommand>& MDSDaemon::get_commands()
{
static const std::vector<MDSCommand> commands = {
- MDSCommand("damage ls", "List detected metadata damage"),
- MDSCommand("damage rm name=damage_id,type=CephInt", "Remove a damage table entry"),
MDSCommand("cache drop name=timeout,type=CephInt,range=0,req=false", "trim cache and optionally request client to release all caps and flush the journal"),
};
return commands;
command_openfiles_ls(f);
} else if (command == "dump inode") {
command_dump_inode(f, cmdmap, ss);
+ } else if (command == "damage ls") {
+ std::lock_guard l(mds_lock);
+ damage_table.dump(f);
+ } else if (command == "damage rm") {
+ std::lock_guard l(mds_lock);
+ damage_entry_id_t id = 0;
+ if (!cmd_getval(g_ceph_context, cmdmap, "damage_id", (int64_t&)id)) {
+ r = -EINVAL;
+ goto out;
+ }
+ damage_table.erase(id);
} else {
r = -ENOSYS;
}
std::string prefix;
cmd_getval(g_ceph_context, cmdmap, "prefix", prefix);
- if (prefix == "damage ls") {
- JSONFormatter f(true);
- damage_table.dump(&f);
- f.flush(*ds);
- return true;
- } else if (prefix == "damage rm") {
- damage_entry_id_t id = 0;
- bool got = cmd_getval(g_ceph_context, cmdmap, "damage_id", (int64_t&)id);
- if (!got) {
- *r = -EINVAL;
- return true;
- }
-
- damage_table.erase(id);
- return true;
- } else if (prefix == "cache drop") {
+ if (prefix == "cache drop") {
int64_t timeout;
if (!cmd_getval(g_ceph_context, cmdmap, "timeout", timeout)) {
timeout = 0;