Commit 8bf8e6fd by Andreas Joachim Peters Committed by Elvin Sindrilaru

MGM/FST: make sure http GET requests receive always the mtime value from the MGM redirector

parent 99733f7d
......@@ -2615,6 +2615,12 @@ XrdFstOfsFile::FilterTagsInPlace(std::string& opaque,
time_t
XrdFstOfsFile::GetMtime()
{
if (!isRW) {
// this is to report the MGM mtime to http get requests
if (mForcedMtime!=1) {
return mForcedMtime;
}
}
if (fMd) {
return fMd->mProtoFmd.mtime();
} else {
......@@ -2677,8 +2683,14 @@ XrdFstOfsFile::ProcessOpenOpaque()
// it should not update the mtime as in the case of FUSE clients which will
// call utimes.
if ((val = mOpenOpaque->Get("mgm.mtime"))) {
mForcedMtime = 0;
mForcedMtime_ms = 0;
time_t mtime = (time_t)strtoull(val, 0, 10);
if (mtime==0) {
mForcedMtime = 0;
mForcedMtime_ms = 0;
} else {
mForcedMtime = mtime;
mForcedMtime_ms = 0;
}
}
// mgm.fusex=1 - Suppress the file close broadcast to the fusex network
......
......@@ -2440,6 +2440,18 @@ XrdMgmOfsFile::open(const char* inpath,
if (isFuse) {
redirectionhost += "&mgm.mtime=0";
} else {
if (!isRW) {
eos::IFileMD::ctime_t mtime;
try {
fmd->getMTime(mtime);
redirectionhost += "&mgm.mtime=";
std::string smtime;
smtime += std::to_string(mtime.tv_sec);
redirectionhost += smtime.c_str();
} catch (eos::MDException& ex) {
}
}
}
// Also trigger synchronous create workflow event if it's defined
......
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