It is important to ensure that all workers have completed the
scan_extents phase before any workers enter the scan_inodes phase.
+After completing the metadata recovery, you may want to run cleanup
+operation to delete ancillary data geneated during recovery.
+
+::
+
+ cephfs-data-scan cleanup <data pool>
+
Finding files affected by lost data PGs
---------------------------------------
return ctx.operate(zeroth_object.name, &op, &outbl);
}
+int ClsCephFSClient::delete_inode_accumulate_result(
+ librados::IoCtx &ctx,
+ const std::string &oid)
+{
+ librados::ObjectWriteOperation op;
+
+ // Remove xattrs from object
+ //
+ op.rmxattr(XATTR_CEILING);
+ op.rmxattr(XATTR_MAX_SIZE);
+ op.rmxattr(XATTR_MAX_MTIME);
+
+ return (ctx.operate(oid, &op));
+}
+
int ClsCephFSClient::fetch_inode_accumulate_result(
librados::IoCtx &ctx,
const std::string &oid,
<< " --force-pool: use data pool even if it is not in FSMap\n"
<< "\n"
<< " cephfs-data-scan scan_frags [--force-corrupt]\n"
+ << " cephfs-data-scan cleanup <data pool name>\n"
<< std::endl;
generic_client_usage();
// Trailing positional argument
if (i + 1 == args.end() &&
- (command == "scan_inodes" || command == "scan_extents")) {
+ (command == "scan_inodes"
+ || command == "scan_extents"
+ || command == "cleanup")) {
data_pool_name = *i;
continue;
}
// Initialize data_io for those commands that need it
if (command == "scan_inodes" ||
- command == "scan_extents") {
+ command == "scan_extents" ||
+ command == "cleanup") {
if (data_pool_name.empty()) {
std::cerr << "Data pool not specified" << std::endl;
usage();
return scan_frags();
} else if (command == "scan_links") {
return scan_links();
+ } else if (command == "cleanup") {
+ return cleanup();
} else if (command == "init") {
return driver->init_roots(fs->mds_map.get_first_data_pool());
} else {
});
}
+int DataScan::cleanup()
+{
+ // We are looking for only zeroth object
+ //
+ return forall_objects(data_io, true, [this](
+ std::string const &oid,
+ uint64_t obj_name_ino,
+ uint64_t obj_name_offset) -> int
+ {
+ int r = 0;
+ r = ClsCephFSClient::delete_inode_accumulate_result(data_io, oid);
+ if (r < 0) {
+ dout(4) << "Error deleting accumulated metadata from '"
+ << oid << "': " << cpp_strerror(r) << dendl;
+ }
+ return r;
+ });
+}
+
bool DataScan::valid_ino(inodeno_t ino) const
{
return (ino >= inodeno_t((1ull << 40)))