| 573 | } |
| 574 | |
| 575 | void ScrubStack::_validate_inode_done(CInode *in, int r, |
| 576 | const CInode::validated_data &result) |
| 577 | { |
| 578 | LogChannelRef clog = mdcache->mds->clog; |
| 579 | const ScrubHeaderRefConst header = in->scrub_info()->header; |
| 580 | |
| 581 | std::string path; |
| 582 | if (!result.passed_validation) { |
| 583 | // Build path string for use in messages |
| 584 | in->make_path_string(path, true); |
| 585 | } |
| 586 | |
| 587 | if (result.backtrace.checked && !result.backtrace.passed && |
| 588 | !result.backtrace.repaired) |
| 589 | { |
| 590 | // Record backtrace fails as remote linkage damage, as |
| 591 | // we may not be able to resolve hard links to this inode |
| 592 | mdcache->mds->damage_table.notify_remote_damaged(in->ino(), path); |
| 593 | } else if (result.inode.checked && !result.inode.passed && |
| 594 | !result.inode.repaired) { |
| 595 | // Record damaged inode structures as damaged dentries as |
| 596 | // that is where they are stored |
| 597 | auto parent = in->get_projected_parent_dn(); |
| 598 | if (parent) { |
| 599 | auto dir = parent->get_dir(); |
| 600 | mdcache->mds->damage_table.notify_dentry( |
| 601 | dir->inode->ino(), dir->frag, parent->last, parent->get_name(), path); |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | // Inform the cluster log if we found an error |
| 606 | if (!result.passed_validation) { |
| 607 | if (result.all_damage_repaired()) { |
| 608 | clog->info() << "Scrub repaired inode " << in->ino() |
| 609 | << " (" << path << ")"; |
| 610 | } else { |
| 611 | clog->warn() << "Scrub error on inode " << in->ino() |
| 612 | << " (" << path << ") see " << g_conf()->name |
| 613 | << " log and `damage ls` output for details"; |
| 614 | } |
| 615 | |
| 616 | // Put the verbose JSON output into the MDS log for later inspection |
| 617 | JSONFormatter f; |
| 618 | result.dump(&f); |
| 619 | CachedStackStringStream css; |
| 620 | f.flush(*css); |
| 621 | derr << __func__ << " scrub error on inode " << *in << ": " << css->strv() |
| 622 | << dendl; |
| 623 | } else { |
| 624 | dout(10) << __func__ << " scrub passed on inode " << *in << dendl; |
| 625 | } |
| 626 | |
| 627 | in->scrub_finished(); |
| 628 | } |
| 629 | |
| 630 | void ScrubStack::complete_control_contexts(int r) { |
| 631 | ceph_assert(ceph_mutex_is_locked_by_me(mdcache->mds->mds_lock)); |
no test coverage detected