Commit 50509a32 authored by Elvin Sindrilaru's avatar Elvin Sindrilaru

FST: Put back check for checksum error during ScanDir operation

parent 90e74c0b
Pipeline #413348 canceled with stages
in 20 minutes and 4 seconds
......@@ -408,83 +408,85 @@ ScanDir::CheckFile(const char* filepath)
#ifndef _NOOFS
if (bgThread) {
XrdOucString manager = "";
{
XrdSysMutexHelper lock(eos::fst::Config::gConfig.Mutex);
manager = eos::fst::Config::gConfig.Manager.c_str();
}
if (filecxerror || blockcxerror) {
XrdOucString manager = "";
{
XrdSysMutexHelper lock(eos::fst::Config::gConfig.Mutex);
manager = eos::fst::Config::gConfig.Manager.c_str();
}
if (manager.length()) {
errno = 0;
eos::common::Path cPath(filePath.c_str());
eos::common::FileId::fileid_t fid = strtoul(cPath.GetName(), 0, 16);
if (manager.length()) {
errno = 0;
eos::common::Path cPath(filePath.c_str());
eos::common::FileId::fileid_t fid = strtoul(cPath.GetName(), 0, 16);
if (fid && !errno) {
// check if we have this file in the local DB, if not, we
// resync first the disk and then the mgm meta data
FmdHelper* fmd = gFmdDbMapHandler.LocalGetFmd(fid, fsId, 0, 0, false,
true);
bool orphaned = false;
if (fmd) {
// real orphanes get rechecked
if (fmd->mProtoFmd.layouterror() & eos::common::LayoutId::kOrphan) {
orphaned = true;
}
if (fid && !errno) {
// check if we have this file in the local DB, if not, we
// resync first the disk and then the mgm meta data
FmdHelper* fmd = gFmdDbMapHandler.LocalGetFmd(fid, fsId, 0, 0, false,
true);
bool orphaned = false;
if (fmd) {
// real orphanes get rechecked
if (fmd->mProtoFmd.layouterror() & eos::common::LayoutId::kOrphan) {
orphaned = true;
// unregistered replicas get rechecked
if (fmd->mProtoFmd.layouterror() & eos::common::LayoutId::kUnregistered) {
orphaned = true;
}
}
// unregistered replicas get rechecked
if (fmd->mProtoFmd.layouterror() & eos::common::LayoutId::kUnregistered) {
orphaned = true;
if (fmd) {
delete fmd;
}
}
if (fmd) {
delete fmd;
}
if (filecxerror || blockcxerror || !fmd || orphaned) {
eos_notice("msg=\"resyncing from disk\" fsid=%d fid=%lx", fsId, fid);
// ask the meta data handling class to update the error flags for this file
gFmdDbMapHandler.ResyncDisk(filePath.c_str(), fsId, false);
eos_notice("msg=\"resyncing from mgm\" fsid=%d fid=%lx", fsId, fid);
bool resynced = false;
resynced = gFmdDbMapHandler.ResyncMgm(fsId, fid, manager.c_str());
fmd = gFmdDbMapHandler.LocalGetFmd(fid, fsId, 0, 0, 0, false, true);
if (resynced && fmd) {
if ((fmd->mProtoFmd.layouterror() == eos::common::LayoutId::kOrphan) ||
((!(fmd->mProtoFmd.layouterror() & eos::common::LayoutId::kReplicaWrong))
&& (fmd->mProtoFmd.layouterror() & eos::common::LayoutId::kUnregistered))) {
char oname[4096];
snprintf(oname, sizeof(oname), "%s/.eosorphans/%08x",
dirPath.c_str(), (unsigned int) fid);
// store the original path name as an extended attribute in case ...
io->attrSet("user.eos.orphaned", filePath.c_str());
// if this is an orphaned file - we move it into the orphaned directory
if (!rename(filePath.c_str(), oname)) {
eos_warning("msg=\"orphaned/unregistered quarantined\" "
"fst-path=%s orphan-path=%s", filePath.c_str(),
oname);
} else {
eos_err("msg=\"failed to quarantine orphaned/unregistered"
"\" fst-path=%s orphan-path=%s", filePath.c_str(),
oname);
if (filecxerror || blockcxerror || !fmd || orphaned) {
eos_notice("msg=\"resyncing from disk\" fsid=%d fid=%lx", fsId, fid);
// ask the meta data handling class to update the error flags for this file
gFmdDbMapHandler.ResyncDisk(filePath.c_str(), fsId, false);
eos_notice("msg=\"resyncing from mgm\" fsid=%d fid=%lx", fsId, fid);
bool resynced = false;
resynced = gFmdDbMapHandler.ResyncMgm(fsId, fid, manager.c_str());
fmd = gFmdDbMapHandler.LocalGetFmd(fid, fsId, 0, 0, 0, false, true);
if (resynced && fmd) {
if ((fmd->mProtoFmd.layouterror() == eos::common::LayoutId::kOrphan) ||
((!(fmd->mProtoFmd.layouterror() & eos::common::LayoutId::kReplicaWrong))
&& (fmd->mProtoFmd.layouterror() & eos::common::LayoutId::kUnregistered))) {
char oname[4096];
snprintf(oname, sizeof(oname), "%s/.eosorphans/%08x",
dirPath.c_str(), (unsigned int) fid);
// store the original path name as an extended attribute in case ...
io->attrSet("user.eos.orphaned", filePath.c_str());
// if this is an orphaned file - we move it into the orphaned directory
if (!rename(filePath.c_str(), oname)) {
eos_warning("msg=\"orphaned/unregistered quarantined\" "
"fst-path=%s orphan-path=%s", filePath.c_str(),
oname);
} else {
eos_err("msg=\"failed to quarantine orphaned/unregistered"
"\" fst-path=%s orphan-path=%s", filePath.c_str(),
oname);
}
// remove the entry from the FMD database
gFmdDbMapHandler.LocalDeleteFmd(fid, fsId);
}
// remove the entry from the FMD database
gFmdDbMapHandler.LocalDeleteFmd(fid, fsId);
delete fmd;
}
delete fmd;
}
// Call the autorepair method on the MGM - but not for orphaned
// or unregistered filed. If MGM autorepair is disabled then it
// doesn't do anything.
if (fmd && !orphaned &&
(!(fmd->mProtoFmd.layouterror() & eos::common::LayoutId::kUnregistered))) {
gFmdDbMapHandler.CallAutoRepair(manager.c_str(), fid);
// Call the autorepair method on the MGM - but not for orphaned
// or unregistered filed. If MGM autorepair is disabled then it
// doesn't do anything.
if (fmd && !orphaned &&
(!(fmd->mProtoFmd.layouterror() & eos::common::LayoutId::kUnregistered))) {
gFmdDbMapHandler.CallAutoRepair(manager.c_str(), fid);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment