Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jewel: fs: Log path as well as ino when detecting metadata damage #11418

Merged
2 commits merged into from Oct 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/mds/CDir.cc
Expand Up @@ -78,9 +78,7 @@ boost::pool<> CDir::pool(sizeof(CDir));

ostream& operator<<(ostream& out, const CDir& dir)
{
string path;
dir.get_inode()->make_path_string_projected(path);
out << "[dir " << dir.dirfrag() << " " << path << "/"
out << "[dir " << dir.dirfrag() << " " << dir.get_path() << "/"
<< " [" << dir.first << ",head]";
if (dir.is_auth()) {
out << " auth";
Expand Down Expand Up @@ -1753,7 +1751,9 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
}

dout(0) << "_fetched missing object for " << *this << dendl;
clog->error() << "dir " << dirfrag() << " object missing on disk; some files may be lost\n";

clog->error() << "dir " << dirfrag() << " object missing on disk; some "
"files may be lost (" << get_path() << ")";

go_bad();
return;
Expand All @@ -1768,13 +1768,14 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
derr << "Corrupt fnode in dirfrag " << dirfrag()
<< ": " << err << dendl;
clog->warn() << "Corrupt fnode header in " << dirfrag() << ": "
<< err;
<< err << " (" << get_path() << ")";
go_bad();
return;
}
if (!p.end()) {
clog->warn() << "header buffer of dir " << dirfrag() << " has "
<< hdrbl.length() - p.get_off() << " extra bytes\n";
<< hdrbl.length() - p.get_off() << " extra bytes ("
<< get_path() << ")";
go_bad();
return;
}
Expand Down Expand Up @@ -1833,7 +1834,7 @@ void CDir::_omap_fetched(bufferlist& hdrbl, map<string, bufferlist>& omap,
} catch (const buffer::error &err) {
cache->mds->clog->warn() << "Corrupt dentry '" << dname << "' in "
"dir frag " << dirfrag() << ": "
<< err;
<< err << "(" << get_path() << ")";

// Remember that this dentry is damaged. Subsequent operations
// that try to act directly on it will get their EIOs, but this
Expand Down Expand Up @@ -2887,9 +2888,7 @@ void CDir::dump(Formatter *f) const
{
assert(f != NULL);

string path;
get_inode()->make_path_string_projected(path);
f->dump_stream("path") << path;
f->dump_stream("path") << get_path();

f->dump_stream("dirfrag") << dirfrag();
f->dump_int("snapid_first", first);
Expand Down Expand Up @@ -3152,3 +3151,11 @@ bool CDir::scrub_local()
}
return rval;
}

std::string CDir::get_path() const
{
std::string path;
get_inode()->make_path_string_projected(path);
return path;
}

4 changes: 4 additions & 0 deletions src/mds/CDir.h
Expand Up @@ -42,6 +42,8 @@ struct ObjectOperation;

ostream& operator<<(ostream& out, const class CDir& dir);
class CDir : public MDSCacheObject {
friend ostream& operator<<(ostream& out, const class CDir& dir);

/*
* This class uses a boost::pool to handle allocation. This is *not*
* thread-safe, so don't do allocations from multiple threads!
Expand Down Expand Up @@ -510,6 +512,8 @@ class CDir : public MDSCacheObject {
*/
mds_authority_t dir_auth;

std::string get_path() const;

public:
mds_authority_t authority() const;
mds_authority_t get_dir_auth() const { return dir_auth; }
Expand Down
2 changes: 1 addition & 1 deletion src/mds/SessionMap.cc
Expand Up @@ -52,7 +52,7 @@ void SessionMap::dump()
<< " state " << p->second->get_state_name()
<< " completed " << p->second->info.completed_requests
<< " prealloc_inos " << p->second->info.prealloc_inos
<< " used_ions " << p->second->info.used_inos
<< " used_inos " << p->second->info.used_inos
<< dendl;
}

Expand Down