Skip to content

Commit

Permalink
[Server] Allow the CKS manager to run on the redirector.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Jun 21, 2018
1 parent e048756 commit b2bc454
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/XrdCks/XrdCksConfig.cc
Expand Up @@ -168,7 +168,7 @@ int XrdCksConfig::Manager(const char *Path, const char *Parms)
Output: 0 upon success or !0 upon failure.
*/

int XrdCksConfig::ParseLib(XrdOucStream &Config)
int XrdCksConfig::ParseLib(XrdOucStream &Config, int &libType)
{
static const int nameSize = XrdCksData::NameSize;
static const int pathSize = MAXPATHLEN;
Expand Down Expand Up @@ -203,7 +203,10 @@ int XrdCksConfig::ParseLib(XrdOucStream &Config)

// Check if this is for the manager
//
if (*buff == '*' && *(buff+1) == ' ') return Manager(buff+2, parms);
if ((*buff == '*' || *buff == '=') && *(buff+1) == ' ')
{libType = (*buff == '*' ? -1 : 1);
return Manager(buff+2, parms);
} else libType = 0;

// Add this digest to the list of digests
//
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCks/XrdCksConfig.hh
Expand Up @@ -52,7 +52,7 @@ int Manager(const char *Path, const char *Parms);
const
char *ManLib() {return CksLib;}

int ParseLib(XrdOucStream &Config);
int ParseLib(XrdOucStream &Config, int &libType);

XrdCksConfig(const char *cFN, XrdSysError *Eroute, int &aOK,
XrdVersionInfo &vInfo);
Expand Down
4 changes: 3 additions & 1 deletion src/XrdOfs/XrdOfs.cc
Expand Up @@ -161,6 +161,8 @@ XrdOfs::XrdOfs()
//
Cks = 0;
CksPfn = true;
CksPfn = true;
CksRdr = true;
}

/******************************************************************************/
Expand Down Expand Up @@ -1360,7 +1362,7 @@ int XrdOfs::chksum( csFunc Func, // In

// If we are a menager then we need to redirect the client to where the file is
//
if (Finder && Finder->isRemote()
if (CksRdr && Finder && Finder->isRemote()
&& (rc = Finder->Locate(einfo, Path, SFS_O_RDONLY, &cksEnv)))
return fsError(einfo, rc);

Expand Down
1 change: 1 addition & 0 deletions src/XrdOfs/XrdOfs.hh
Expand Up @@ -376,6 +376,7 @@ short poscAuto; // 1 -> Automatic persist on close

char ossRW; // The oss r/w capability
bool CksPfn; // Checksum needs a pfn
bool CksRdr; // Checksum may be redirected (i.e. not local)
XrdOfsConfigPI *ofsConfig; // Plugin configurator
XrdCks *Cks; // Checksum manager
char Reserved[3]; // Reserved for future checksum stuff
Expand Down
1 change: 1 addition & 0 deletions src/XrdOfs/XrdOfsConfig.cc
Expand Up @@ -264,6 +264,7 @@ int XrdOfs::Configure(XrdSysError &Eroute, XrdOucEnv *EnvInfo) {
else {ofsConfig->Plugin(XrdOfsOss);
ofsConfig->Plugin(Cks);
CksPfn = !ofsConfig->OssCks();
CksRdr = !ofsConfig->LclCks();
if (Options & Authorize)
{ofsConfig->Plugin(Authorization);
XrdOfsTPC::Init(Authorization);
Expand Down
7 changes: 5 additions & 2 deletions src/XrdOfs/XrdOfsConfigPI.cc
Expand Up @@ -89,7 +89,7 @@ XrdOfsConfigPI::XrdOfsConfigPI(const char *cfn, XrdOucStream *cfgP,
: autPI(0), cksPI(0), cmsPI(0), ossPI(0), urVer(verP),
Config(cfgP), Eroute(errP), CksConfig(0), ConfigFN(cfn),
CksAlg(0), CksRdsz(0), ossXAttr(false), ossCksio(false),
Loaded(false), LoadOK(false)
Loaded(false), LoadOK(false), cksLcl(false)
{
int rc;

Expand Down Expand Up @@ -276,7 +276,10 @@ bool XrdOfsConfigPI::Parse(TheLib what)
break;
case theAutLib: break;
case theCksLib: if (CksConfig)
{if (CksConfig->ParseLib(*Config)) return false;
{int libType;
if (CksConfig->ParseLib(*Config, libType))
return false;
if (libType) cksLcl = libType == 1;
RepLib(theCksLib, CksConfig->ManLib(), nullParms);
return true;
}
Expand Down
9 changes: 9 additions & 0 deletions src/XrdOfs/XrdOfsConfigPI.hh
Expand Up @@ -140,6 +140,14 @@ static
XrdOfsConfigPI *New(const char *cfn, XrdOucStream *cfgP, XrdSysError *errP,
XrdVersionInfo *verP=0);

//-----------------------------------------------------------------------------
//! Check if the checksum plugin runs on tghe local node irrespective of type.
//!
//! @return True if the plugin runs on the local node, false otherwise.
//-----------------------------------------------------------------------------

bool LclCks() {return cksLcl;}

//-----------------------------------------------------------------------------
//! Check if the checksum plugin uses the oss plugin.
//!
Expand Down Expand Up @@ -237,5 +245,6 @@ bool ossXAttr;
bool ossCksio;
bool Loaded;
bool LoadOK;
bool cksLcl;
};
#endif

0 comments on commit b2bc454

Please sign in to comment.