XRootD
XrdCmsNode Class Reference

#include <XrdCmsNode.hh>

+ Collaboration diagram for XrdCmsNode:

Public Member Functions

 XrdCmsNode (XrdLink *lnkp, const char *theIF=0, const char *sid=0, int port=0, int lvl=0, int id=-1)
 
 ~XrdCmsNode ()
 
void Delete (XrdSysFusedMutex &gMutex)
 
void Delete (XrdSysMutex &gMutex)
 
void Delete (XrdSysRWLock &gMutex)
 
void Disc (const char *reason=0, int needLock=1)
 
const char * do_Avail (XrdCmsRRData &Arg)
 
const char * do_Chmod (XrdCmsRRData &Arg)
 
const char * do_Disc (XrdCmsRRData &Arg)
 
const char * do_Gone (XrdCmsRRData &Arg)
 
const char * do_Have (XrdCmsRRData &Arg)
 
const char * do_Load (XrdCmsRRData &Arg)
 
const char * do_Locate (XrdCmsRRData &Arg)
 
const char * do_Mkdir (XrdCmsRRData &Arg)
 
const char * do_Mkpath (XrdCmsRRData &Arg)
 
const char * do_Mv (XrdCmsRRData &Arg)
 
const char * do_Ping (XrdCmsRRData &Arg)
 
const char * do_Pong (XrdCmsRRData &Arg)
 
const char * do_PrepAdd (XrdCmsRRData &Arg)
 
const char * do_PrepDel (XrdCmsRRData &Arg)
 
const char * do_Rm (XrdCmsRRData &Arg)
 
const char * do_Rmdir (XrdCmsRRData &Arg)
 
int do_SelAvoid (XrdCmsRRData &Arg, XrdCmsSelect &Sel, char *Avoid, bool &doRedir)
 
const char * do_Select (XrdCmsRRData &Arg)
 
const char * do_Space (XrdCmsRRData &Arg)
 
const char * do_State (XrdCmsRRData &Arg)
 
int do_StateFWD (XrdCmsRRData &Arg)
 
const char * do_StatFS (XrdCmsRRData &Arg)
 
const char * do_Stats (XrdCmsRRData &Arg)
 
const char * do_Status (XrdCmsRRData &Arg)
 
const char * do_Trunc (XrdCmsRRData &Arg)
 
const char * do_Try (XrdCmsRRData &Arg)
 
const char * do_Update (XrdCmsRRData &Arg)
 
const char * do_Usage (XrdCmsRRData &Arg)
 
void g2nLock (XrdSysRWLock &gMutex)
 
short getSlot ()
 
int ID (int &INum)
 
bool inDomain ()
 
int Inst ()
 
int isNode (const XrdNetAddr *addr)
 
int isNode (SMask_t smask)
 
int isNode (XrdLink *lp, const char *nid, int port)
 
void Lock ()
 
SMask_t Mask ()
 
void n2gLock (XrdSysRWLock &gMutex, bool rdlock=false)
 
char * Name ()
 
void Ref ()
 
int Send (const char *buff, int blen=0)
 
int Send (const struct iovec *iov, int iovcnt, int iotot=0)
 
void setManager (XrdCmsManager *mP)
 
void setName (XrdLink *lnkp, const char *theIF, int port)
 
void setShare (int shrval)
 
void setSlot (short rslot)
 
int setTZone (int tZone)
 
void setVersion (unsigned short vnum)
 
void ShowIF ()
 
void SyncSpace ()
 
void UnLock ()
 
void unRef ()
 

Static Public Member Functions

static int do_LocFmt (char *buff, XrdCmsSelected *sP, SMask_t pf, SMask_t wf, bool lsall=false, bool lsuniq=false)
 
static int do_SelPrep (XrdCmsPrepArgs &Arg)
 
static void do_StateDFS (XrdCmsBaseFR *rP, int rc)
 
static void Report_Usage (XrdLink *lp)
 

Public Attributes

unsigned int ConfigID = 0
 
int DiskFree = 0
 
int DiskMinF = 0
 
int DiskNums = 0
 
unsigned int DiskTotal = 0
 
int DiskUtil = 0
 
char hasNet = 0
 
char * Ident = 0
 
char isBad = 0
 
char isBound = 0
 
char isConn = 0
 
char isGone = 0
 
char isKnown = 0
 
char isMan = 0
 
char isNoStage = 0
 
char isOffline
 
char isPeer = 0
 
char isPerm = 0
 
char isRW = 0
 
char RoleID = 0
 
char rsvd = 0
 
char TimeZone = 0
 
char TZValid = 0
 

Static Public Attributes

static const char allowsRW = 0x01
 
static const char allowsSS = 0x02
 
static const char isBlisted = 0x01
 
static const char isDisabled = 0x02
 
static const char isDoomed = 0x08
 
static const char isSuspend = 0x04
 

Friends

class XrdCmsCluster
 

Detailed Description

Definition at line 57 of file XrdCmsNode.hh.

Constructor & Destructor Documentation

◆ XrdCmsNode()

XrdCmsNode::XrdCmsNode ( XrdLink lnkp,
const char *  theIF = 0,
const char *  sid = 0,
int  port = 0,
int  lvl = 0,
int  id = -1 
)

Definition at line 98 of file XrdCmsNode.cc.

100 {
101  static XrdSysMutex iMutex;
102  static const SMask_t smask_1(1);
103  static int iNum = 1;
104 
105  Link = lnkp;
106  NodeMask = (id < 0 ? 0 : smask_1 << id);
107  NodeID = id;
108  isOffline= (lnkp == 0);
109  logload = Config.LogPerf;
110  myNID = strdup(nid ? nid : "?");
111  if ((myCID = index(myNID, ' '))) myCID++;
112  else myCID = myNID;
113  myLevel = lvl;
114  myVersion= kYR_Version;
115 
116 // setName() will set the node identification information
117 //
118  setName(lnkp, theIF, (nid ? port : 0));
119 
120  iMutex.Lock();
121  Instance = iNum++;
122  iMutex.UnLock();
123 }
unsigned long long SMask_t
Definition: XrdCmsTypes.hh:33
char isOffline
Definition: XrdCmsNode.hh:64
void setName(XrdLink *lnkp, const char *theIF, int port)
Definition: XrdCmsNode.cc:145
static const unsigned char kYR_Version
Definition: YProtocol.hh:80
XrdCmsConfig Config

References XrdCms::Config, XrdCms::kYR_Version, XrdSysMutex::Lock(), XrdCmsConfig::LogPerf, XrdCms::myVersion, and XrdSysMutex::UnLock().

+ Here is the call graph for this function:

◆ ~XrdCmsNode()

XrdCmsNode::~XrdCmsNode ( )

Definition at line 129 of file XrdCmsNode.cc.

130 {
131  isOffline = 1; // STMutex not needed here
132 
133 // Delete other appendages
134 //
135  if (cidP) {cidP->RemNode(this); cidP = 0;}
136  if (Ident) free(Ident);
137  if (myNID) free(myNID);
138  if (myName)free(myName);
139 }
XrdCmsNode * RemNode(XrdCmsNode *nP)
char * Ident
Definition: XrdCmsNode.hh:61

Member Function Documentation

◆ Delete() [1/3]

void XrdCmsNode::Delete ( XrdSysFusedMutex gMutex)

Definition at line 186 of file XrdCmsNode.cc.

187 {
188  EPNAME("Delete");
189  static const int warnIntvl = 60;
190  int totWait = 0, tmoWarn = 60;
191  int tmoWait (Config.DELDelay < 3 ? Config.DELDelay : 3);
192  bool doDel = true;
193 
194 // We need to make sure there are no references to this object. This is true
195 // when the refCnt is zero but only when we hold a global write lock that has
196 // been passed to us. As this node has been removed from all global tables
197 // at this point, we just need to make sure than no threads are poised to
198 // increase it. That can't happen if we obrtain a write lock. To start,
199 // get the node lock and do some debugging. Set the isGone flag even though it
200 // should be set. Note that we need to serialize with the refCnt as some
201 // threads may still be holding a reference to the node.
202 //
203  nodeMutex.Lock();
204  isGone = 1;
205  nodeMutex.UnLock();
206  DEBUG(Ident <<" refs=" <<refCnt);
207 
208 // Now wait for things to simmer down. We wait for an appropriate time because
209 // we don't want to occupy this thread forever.
210 //
211  gMutex.WriteLock();
212  while(refCnt)
213  {if (totWait >= Config.DELDelay) {doDel = false; break;}
214  gMutex.UnLock();
215  if (totWait >= tmoWarn)
216  {unsigned int theCnt = refCnt;
217  DeleteWarn(theCnt);
218  tmoWarn += warnIntvl;
219  }
220  XrdSysTimer::Snooze(tmoWait);
221  totWait += tmoWait;
222  gMutex.WriteLock();
223  }
224  gMutex.UnLock();
225 
226 // We can now safely delete this node
227 //
228  if (doDel) delete this;
229  else {char eBuff[256];
230  snprintf(eBuff, sizeof(eBuff),
231  " (%p) delete timeout; node object lost!", this);
232  Say.Emsg("Delete", Ident, eBuff);
233  }
234 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
char isGone
Definition: XrdCmsNode.hh:72
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
static void Snooze(int seconds)
Definition: XrdSysTimer.cc:168
XrdSysError Say

References XrdCms::Config, DEBUG, XrdCmsConfig::DELDelay, XrdSysError::Emsg(), EPNAME, XrdCms::Say, XrdSysTimer::Snooze(), XrdSysFusedMutex::UnLock(), and XrdSysFusedMutex::WriteLock().

+ Here is the call graph for this function:

◆ Delete() [2/3]

void XrdCmsNode::Delete ( XrdSysMutex gMutex)
inline

Definition at line 132 of file XrdCmsNode.hh.

133  {XrdSysFusedMutex gMeld(gMutex); Delete(gMeld);}
void Delete(XrdSysRWLock &gMutex)
Definition: XrdCmsNode.hh:129

References Delete().

+ Here is the call graph for this function:

◆ Delete() [3/3]

void XrdCmsNode::Delete ( XrdSysRWLock gMutex)
inline

Definition at line 129 of file XrdCmsNode.hh.

130  {XrdSysFusedMutex gMeld(gMutex); Delete(gMeld);}

Referenced by Delete().

+ Here is the caller graph for this function:

◆ Disc()

void XrdCmsNode::Disc ( const char *  reason = 0,
int  needLock = 1 
)

Definition at line 256 of file XrdCmsNode.cc.

257 {
258 // Indicate we are offline. If a lock is not need then we only need to set the
259 // offline flag as it's already properly protected. Otherwise, set the flag
260 // after we get the lock. This is indeed messy.
261 //
262  if (needLock) nodeMutex.Lock();
263  isOffline = 1; // STMutex is already held if needed
264 
265 // If we are still connected, initiate a teardown. This may be done async as
266 // we are asking for a deferred close which will be followed by a full close.
267 //
268  if (isConn)
269  {Link->setEtext(reason);
270  Link->Close(1);
271  isConn = 0;
272  }
273 
274 // Unlock ourselves if we locked ourselves
275 //
276  if (needLock) nodeMutex.UnLock();
277 }
char isConn
Definition: XrdCmsNode.hh:71

Referenced by XrdCmsCluster::Remove().

+ Here is the caller graph for this function:

◆ do_Avail()

const char * XrdCmsNode::do_Avail ( XrdCmsRRData Arg)

Definition at line 286 of file XrdCmsNode.cc.

287 {
288  EPNAME("do_Avail")
289 
290 // Process: avail <fsdsk> <util>
291 //
292  DiskFree = Arg.dskFree;
293  DiskUtil = static_cast<int>(Arg.dskUtil);
294 
295 // Do some debugging
296 //
297  DEBUGR(DiskFree <<"MB free; " <<DiskUtil <<"% util");
298  return 0;
299 }
#define DEBUGR(y)
Definition: XrdCmsTrace.hh:51
int DiskFree
Definition: XrdCmsNode.hh:90
int DiskUtil
Definition: XrdCmsNode.hh:91

References DEBUGR, XrdCmsRRData::dskFree, and EPNAME.

◆ do_Chmod()

const char * XrdCmsNode::do_Chmod ( XrdCmsRRData Arg)

Definition at line 307 of file XrdCmsNode.cc.

308 {
309  EPNAME("do_Chmod")
310  mode_t mode = 0;
311  int rc;
312 
313 // Do some debugging
314 //
315  DEBUGR("mode " <<Arg.Mode <<' ' <<Arg.Path);
316 
317 // We are don here if we have no data; otherwise convert the mode if we
318 // haven't done so already.
319 //
320  if (!Config.DiskOK) return 0;
321  if (!mode && !getMode(Arg.Mode, mode)) return "invalid mode";
322 
323 // Attempt to change the mode either via call-out or the oss plug-in
324 //
325  if (Config.ProgCH) rc = fsExec(Config.ProgCH, Arg.Mode, Arg.Path);
326  else rc = Config.ossFS->Chmod(Arg.Path, mode);
327 
328 // Return appropriate result
329 //
330  return (rc ? fsFail(Arg.Ident, "chmod", Arg.Path, rc) : 0);
331 }
int Mode
XrdOucString Path
if(Avsz)

References XrdOss::Chmod(), XrdCms::Config, DEBUGR, XrdCmsConfig::DiskOK, EPNAME, XrdCmsRRData::Ident, XrdCmsRRData::Mode, XrdCmsConfig::ossFS, XrdCmsRRData::Path, and XrdCmsConfig::ProgCH.

+ Here is the call graph for this function:

◆ do_Disc()

const char * XrdCmsNode::do_Disc ( XrdCmsRRData Arg)

Definition at line 341 of file XrdCmsNode.cc.

342 {
343 
344 // Indicate we have received a disconnect
345 //
346  Say.Emsg("Node", Link->Name(), "requested a disconnect");
347 
348 // If we must send a disc request, do so now
349 //
350  if (Config.asManager()) Link->Send((char *)&Arg.Request,sizeof(Arg.Request));
351 
352 // Close the link and return an error
353 //
354  isOffline = 1; // STMutex not needed here
355  Link->Close(1);
356  return "."; // Signal disconnect
357 }
XrdCms::CmsRRHdr Request
Definition: XrdCmsRRData.hh:54

References XrdCmsConfig::asManager(), XrdCms::Config, XrdSysError::Emsg(), XrdCmsRRData::Request, and XrdCms::Say.

+ Here is the call graph for this function:

◆ do_Gone()

const char * XrdCmsNode::do_Gone ( XrdCmsRRData Arg)

Definition at line 366 of file XrdCmsNode.cc.

367 {
368  EPNAME("do_Gone")
369  static const SMask_t allNodes(~0);
370  int newgone;
371 
372 // Do some debugging
373 //
374  TRACER(Files,Arg.Path);
375 
376 // Update path information and delete this from the prep queue if we are a
377 // staging node. We can also be called via the admin end-point interface
378 // In this case, we have no cache and simply forward up the request.
379 //
380  if (Config.asManager())
382  newgone = Cache.DelFile(Sel, baseFS.isDFS() ? allNodes : NodeMask);
383  } else {
384  newgone = 1;
385  if (Config.DiskSS) PrepQ.Gone(Arg.Path);
386  }
387 
388 // If we have no managers and we still have the file or never had it, return
389 //
390  if (!XrdCmsManager::Present() || !newgone) return 0;
391 
392 // Back-propogate the gone to all of our managers
393 //
394  XrdCmsManager::Inform(Arg.Request, Arg.Buff, Arg.Dlen);
395 
396 // All done
397 //
398  return 0;
399 }
#define TRACER(x, y)
Definition: XrdCmsTrace.hh:58
int DelFile(XrdCmsSelect &Sel, SMask_t mask)
Definition: XrdCmsCache.cc:191
static void Inform(const char *What, const char *Data, int Dlen)
static bool Present()
void Gone(char *path)
XrdCmsCache Cache
Definition: XrdPfcFile.hh:204
XrdCmsBaseFS baseFS
XrdCmsPrepare PrepQ

References XrdCmsSelect::Advisory, XrdCmsConfig::asManager(), XrdCms::baseFS, XrdCmsRRData::Buff, XrdCms::Cache, XrdCms::Config, XrdCmsCache::DelFile(), XrdCmsConfig::DiskSS, XrdCmsRRData::Dlen, EPNAME, XrdCmsPrepare::Gone(), XrdCmsManager::Inform(), XrdCmsBaseFS::isDFS(), XrdCmsRRData::Path, XrdCmsRRData::PathLen, XrdCms::PrepQ, XrdCmsManager::Present(), XrdCmsRRData::Request, and TRACER.

+ Here is the call graph for this function:

◆ do_Have()

const char * XrdCmsNode::do_Have ( XrdCmsRRData Arg)

Definition at line 408 of file XrdCmsNode.cc.

409 {
410  EPNAME("do_Have")
411  static const SMask_t allNodes(~0);
412  XrdCmsPInfo pinfo;
413  int isnew, Opts;
414 
415 // Do some debugging
416 //
417  TRACER(Files, (Arg.Request.modifier&CmsHaveRequest::Pending ? "P ":"")
418  <<Arg.Path);
419 
420 // Find if we can handle the file in r/w mode and if staging is present
421 //
422  Opts = (Cache.Paths.Find(Arg.Path, pinfo) && (pinfo.rwvec & NodeMask)
423  ? XrdCmsSelect::Write : 0);
424  if (Arg.Request.modifier & CmsHaveRequest::Pending)
425  Opts |= XrdCmsSelect::Pending;
426 
427 // Update path information. If we are exporting a shared-everything file system
428 // then we need to also provide the cache the current list of nodes and how
429 // they export the path in question for fast redispatch processing.
430 //
431  if (!Config.asManager()) isnew = 1;
433  Sel.Path.Hash = Arg.Request.streamid;
434  if (baseFS.isDFS())
435  {Sel.Vec.hf = pinfo.rovec; Sel.Vec.wf = pinfo.rwvec;
436  isnew = Cache.AddFile(Sel, allNodes);
437  } else isnew = Cache.AddFile(Sel, NodeMask);
438  }
439 
440 // Return if we have no managers or we already informed the managers
441 //
442  if (!XrdCmsManager::Present() || !isnew) return 0;
443 
444 // Back-propogate the have to all of our managers
445 //
446  XrdCmsManager::Inform(Arg.Request, Arg.Buff, Arg.Dlen);
447 
448 // All done
449 //
450  return 0;
451 }
int AddFile(XrdCmsSelect &Sel, SMask_t mask)
Definition: XrdCmsCache.cc:117
SMask_t rovec
Definition: XrdCmsPList.hh:47
SMask_t rwvec
Definition: XrdCmsPList.hh:48
kXR_unt32 streamid
Definition: YProtocol.hh:83
int Opts
Definition: XrdMpxStats.cc:58

References XrdCmsCache::AddFile(), XrdCmsSelect::Advisory, XrdCmsConfig::asManager(), XrdCms::baseFS, XrdCmsRRData::Buff, XrdCms::Cache, XrdCms::Config, XrdCmsRRData::Dlen, EPNAME, XrdCmsPList_Anchor::Find(), XrdCmsKey::Hash, XrdCmsManager::Inform(), XrdCmsBaseFS::isDFS(), XrdCms::CmsRRHdr::modifier, XrdMpx::Opts, XrdCmsRRData::Path, XrdCmsSelect::Path, XrdCmsRRData::PathLen, XrdCmsCache::Paths, XrdCms::CmsHaveRequest::Pending, XrdCmsSelect::Pending, XrdCmsManager::Present(), XrdCmsRRData::Request, XrdCmsPInfo::rovec, XrdCmsPInfo::rwvec, XrdCms::CmsRRHdr::streamid, TRACER, XrdCmsSelect::Vec, and XrdCmsSelect::Write.

+ Here is the call graph for this function:

◆ do_Load()

const char * XrdCmsNode::do_Load ( XrdCmsRRData Arg)

Definition at line 459 of file XrdCmsNode.cc.

460 {
461  EPNAME("do_Load")
462  uint32_t pcpu, pnet, pxeq, pmem, ppag, pdsk;
463  int temp;
464 
465 // Process: load <cpu> <io> <load> <mem> <pag> <util> <rsvd> <dskFree>
466 // 0 1 2 3 4 5 6
467  pcpu = static_cast<uint32_t>(Arg.Opaque[CmsLoadRequest::cpuLoad]);
468  pnet = static_cast<uint32_t>(Arg.Opaque[CmsLoadRequest::netLoad]);
469  pxeq = static_cast<uint32_t>(Arg.Opaque[CmsLoadRequest::xeqLoad]);
470  pmem = static_cast<uint32_t>(Arg.Opaque[CmsLoadRequest::memLoad]);
471  ppag = static_cast<uint32_t>(Arg.Opaque[CmsLoadRequest::pagLoad]);
472  pdsk = static_cast<uint32_t>(Arg.Opaque[CmsLoadRequest::dskLoad]);
473 
474 // Compute actual load value. Note that the update is not thread-kosher as we
475 // do not obtain a write lock. However, the values below use the single writer
476 // principal so other threads will eventually see a coherent picture. This is
477 // good enough for what these values are used for.
478 //
479  myLoad = Meter.calcLoad(pcpu, pnet, pxeq, pmem, ppag);
480  myMass = Meter.calcLoad(myLoad, pdsk);
481  DiskFree = Arg.dskFree;
482  DiskUtil = pdsk;
483 
484 // Do some debugging
485 //
486  DEBUGR("cpu=" <<pcpu <<" net=" <<pnet <<" xeq=" <<pxeq
487  <<" mem=" <<pmem <<" pag=" <<ppag <<" dsk=" <<pdsk
488  <<"% " <<DiskFree <<"MB load=" <<myLoad <<" mass=" <<myMass);
489 
490 // If we are also a manager then use this load figure to come up with
491 // an overall load to report when asked. If we get free space, then we
492 // must report that now so that we can be selected for allocation.
493 //
494  if (Config.asManager())
495  {Meter.Record(pcpu, pnet, pxeq, pmem, ppag, pdsk);
496  if (isRW && DiskFree != LastFree)
497  {mlMutex.Lock();
498  temp = LastFree; LastFree = DiskFree; Meter.setVirtUpdt();
499  if (!temp && DiskFree >= Config.DiskMin) do_Space(Arg);
500  mlMutex.UnLock();
501  }
502  }
503 
504 // Report new load if need be
505 //
506  if (Config.LogPerf && !logload)
507  {char buff[1024];
508  long long tRefs = Cluster.Refs();
509  long long nRefs = static_cast<long long>(RefTotW + RefTotR)*100;
510  long long sRefs = static_cast<long long>(Share) * Shrin * 100;
511  int myShr = (Share ? Share : 100);
512  if (tRefs) {nRefs /= tRefs; sRefs /= tRefs;}
513  else nRefs = sRefs = 0;
514  snprintf(buff, sizeof(buff)-1,
515  "load=%d; cpu=%d net=%d inq=%d mem=%d pag=%d dsk=%d utl=%d "
516  "shr=[%d %lld %lld] ref=[%d %d]",
517  myLoad, pcpu, pnet, pxeq, pmem, ppag, Arg.dskFree, pdsk,
518  myShr, nRefs, sRefs, RefTotR+RefR, RefTotW+RefW);
519  Say.Emsg("Node", Name(), buff);
520  logload = Config.LogPerf;
521  } else logload--;
522 
523 // Return as if we had gotten a pong
524 //
525  return do_Pong(Arg);
526 }
long long Refs()
void Record(int pcpu, int pnet, int pxeq, int pmem, int ppag, int pdsk)
Definition: XrdCmsMeter.cc:351
void setVirtUpdt()
Definition: XrdCmsMeter.hh:78
const char * do_Space(XrdCmsRRData &Arg)
Definition: XrdCmsNode.cc:1258
const char * do_Pong(XrdCmsRRData &Arg)
Definition: XrdCmsNode.cc:862
char * Name()
Definition: XrdCmsNode.hh:158
unsigned int dskFree
Definition: XrdCmsRRData.hh:67
XrdCmsMeter Meter
Definition: XrdCmsMeter.hh:131
XrdCmsCluster Cluster

References XrdCmsConfig::asManager(), XrdCmsMeter::calcLoad(), XrdCms::Cluster, XrdCms::Config, XrdCms::CmsLoadRequest::cpuLoad, DEBUGR, XrdCmsConfig::DiskMin, XrdCmsRRData::dskFree, XrdCms::CmsLoadRequest::dskLoad, XrdSysError::Emsg(), EPNAME, XrdCmsConfig::LogPerf, XrdCms::CmsLoadRequest::memLoad, XrdCms::Meter, XrdCms::CmsLoadRequest::netLoad, XrdCmsRRData::Opaque, XrdCms::CmsLoadRequest::pagLoad, XrdCmsMeter::Record(), XrdCmsCluster::Refs(), XrdCms::Say, XrdCmsMeter::setVirtUpdt(), and XrdCms::CmsLoadRequest::xeqLoad.

+ Here is the call graph for this function:

◆ do_Locate()

const char * XrdCmsNode::do_Locate ( XrdCmsRRData Arg)

Definition at line 533 of file XrdCmsNode.cc.

534 {
535  EPNAME("do_Locate";)
536  XrdCmsRRQInfo reqInfo(Instance,RSlot,Arg.Request.streamid,Config.QryMinum);
537  XrdCmsSelect Sel(0, Arg.Path, Arg.PathLen-1);
538  XrdCmsSelected *sP = 0;
539  struct {kXR_unt32 Val;
540  char outbuff[CmsLocateRequest::RHLen*STMax];} Resp;
541  struct iovec ioV[2] = {{(char *)&Arg.Request, sizeof(Arg.Request)},
542  {(char *)&Resp, 0}};
543  const char *Why;
544  char eBuff[128], theopts[8], *toP = theopts;
546  XrdNetIF::ifType ifType;
547  int rc, bytes;
548  bool lsuniq = false, oksel = false, lsall = (*Arg.Path == '*');
549 
550 // Get the right interface selection options
551 //
552  ifType = ifVec[(Arg.Opts & CmsLocateRequest::kYR_retipmsk)
553  >> CmsLocateRequest::kYR_retipsft];
554 
555 // Indicate whether we want a name or an actual address
556 //
557  lsopts = (Arg.Opts & CmsLocateRequest::kYR_retname
559 
560 // Indicate if only a single server entry should be listed
561 //
562  if (Arg.Opts & CmsLocateRequest::kYR_retuniq && baseFS.isDFS())
563  {lsuniq = true; *toP++='u';}
564 
565 // Indicate whether we can ignore network restrictions
566 //
567  if (Arg.Opts & CmsLocateRequest::kYR_listall)
568  lsopts |= XrdCmsCluster::LS_ANY;
569 
570 // Indicate whether we ony want to list a single entry
571 //
572 
573 // Handle private networks here
574 //
575  if (Arg.Opts & CmsLocateRequest::kYR_prvtnet)
576  {XrdNetIF::Privatize(ifType);
577  *toP++='P';
578  }
579 
580 // Encode if type into the options
581 //
582  Sel.Opts = static_cast<int>(ifType) & XrdCmsSelect::ifWant;
583  lsopts = static_cast<XrdCmsCluster::CmsLSOpts>(lsopts | ifType);
584 
585 // Grab various options
586 //
587  if (Arg.Opts & CmsLocateRequest::kYR_refresh)
588  {Sel.Opts = XrdCmsSelect::Refresh; *toP++='s';}
589  if (Arg.Opts & CmsLocateRequest::kYR_asap)
590  {Sel.Opts |= XrdCmsSelect::Asap; *toP++='i'; Sel.InfoP = &reqInfo;
591  reqInfo.lsLU = static_cast<char>(lsopts);
592  }
593  else Sel.InfoP = 0;
594 
595 // Do some debugging
596 //
597  *toP = '\0';
598  DEBUGR(theopts <<' ' <<Arg.Path);
599 
600 // Perform location
601 //
602  if ((rc = Cluster.Locate(Sel)))
603  {if (rc > 0)
604  {Arg.Request.rrCode = kYR_wait;
605  bytes = sizeof(Resp.Val); Why = "delay ";
606  } else {
607  if (rc == XrdCmsCluster::Wait4CBk) return 0;
608  Arg.Request.rrCode = kYR_error;
609  rc = kYR_ENOENT; Why = "miss ";
610  bytes = strlcpy(Resp.outbuff, "No servers have access to the file",
611  sizeof(Resp.outbuff)) + sizeof(Resp.Val) + 1;
612  }
613  } else {Why = "?"; bytes = 0;}
614 
615 // List the servers
616 //
617  if (!rc)
618  {if (!Sel.Vec.hf || !(sP=Cluster.List(Sel.Vec.hf, lsopts, oksel)))
619  {const char *eTxt;
620  Arg.Request.rrCode = kYR_error;
621  if (oksel)
622  {rc = kYR_ENETUNREACH; Why = "unreachable ";
623  sprintf(eBuff, "No servers are reachable via %s network",
624  XrdNetIF::Name(ifType));
625  eTxt = eBuff;
626  } else {
627  rc = kYR_ENOENT; Why = "none ";
628  eTxt = "No servers have the file";
629  }
630  bytes = strlcpy(Resp.outbuff, eTxt,
631  sizeof(Resp.outbuff)) + sizeof(Resp.Val) + 1;
632  } else rc = 0;
633  }
634 
635 // Either prepare to send an error or format the result
636 //
637  if (rc)
638  {Resp.Val = htonl(rc);
639  DEBUGR(Why <<Arg.Path);
640  } else {
641  bytes = do_LocFmt(Resp.outbuff, sP, Sel.Vec.pf, Sel.Vec.wf, lsall,lsuniq)
642  + sizeof(Resp.Val) + 1;
643  Resp.Val = 0;
644  Arg.Request.rrCode = kYR_data;
645  }
646 
647 // Send off the response
648 //
649  Arg.Request.datalen = htons(bytes);
650  ioV[1].iov_len = bytes;
651  Link->Send(ioV, 2, bytes+sizeof(Arg.Request));
652  return 0;
653 }
unsigned int kXR_unt32
Definition: XPtypes.hh:90
#define STMax
Definition: XrdCmsTypes.hh:39
size_t strlcpy(char *dst, const char *src, size_t sz)
int Locate(XrdCmsSelect &Sel)
XrdCmsSelected * List(SMask_t mask, CmsLSOpts opts, bool &oksel)
static const int Wait4CBk
static int do_LocFmt(char *buff, XrdCmsSelected *sP, SMask_t pf, SMask_t wf, bool lsall=false, bool lsuniq=false)
Definition: XrdCmsNode.cc:659
unsigned int Opts
Definition: XrdCmsRRData.hh:65
static const char * Name(ifType ifT)
Definition: XrdNetIF.hh:312
ifType
The enum that is used to index into ifData to get appropriate interface.
Definition: XrdNetIF.hh:65
static void Privatize(ifType &x)
Definition: XrdNetIF.hh:330
kXR_unt16 datalen
Definition: YProtocol.hh:86
@ kYR_ENETUNREACH
Definition: YProtocol.hh:158
@ kYR_ENOENT
Definition: YProtocol.hh:150
@ kYR_data
Definition: YProtocol.hh:141
@ kYR_wait
Definition: YProtocol.hh:144
@ kYR_error
Definition: YProtocol.hh:142
kXR_char rrCode
Definition: YProtocol.hh:84

References XrdCmsSelect::Asap, XrdCms::baseFS, XrdCms::Cluster, XrdCms::Config, XrdCms::CmsRRHdr::datalen, DEBUGR, EPNAME, XrdCmsSelect::ifWant, XrdCmsSelect::InfoP, XrdCmsBaseFS::isDFS(), XrdCms::CmsLocateRequest::kYR_asap, XrdCms::kYR_data, XrdCms::kYR_ENETUNREACH, XrdCms::kYR_ENOENT, XrdCms::kYR_error, XrdCms::CmsLocateRequest::kYR_listall, XrdCms::CmsLocateRequest::kYR_prvtnet, XrdCms::CmsLocateRequest::kYR_refresh, XrdCms::CmsLocateRequest::kYR_retipmsk, XrdCms::CmsLocateRequest::kYR_retipsft, XrdCms::CmsLocateRequest::kYR_retname, XrdCms::CmsLocateRequest::kYR_retuniq, XrdCms::kYR_wait, XrdCmsCluster::List(), XrdCmsCluster::Locate(), XrdCmsCluster::LS_ANY, XrdCmsCluster::LS_IDNT, XrdCmsCluster::LS_IPO, XrdCmsCluster::LS_NULL, XrdCmsRRQInfo::lsLU, XrdNetIF::Name(), XrdCmsRRData::Opts, XrdCmsSelect::Opts, XrdCmsRRData::Path, XrdCmsRRData::PathLen, XrdNetIF::Privatize(), XrdCmsConfig::QryMinum, XrdCmsSelect::Refresh, XrdCmsRRData::Request, XrdCms::CmsLocateRequest::RHLen, XrdCms::CmsRRHdr::rrCode, STMax, XrdCms::CmsRRHdr::streamid, strlcpy(), XrdCmsSelect::Vec, and XrdCmsCluster::Wait4CBk.

+ Here is the call graph for this function:

◆ do_LocFmt()

int XrdCmsNode::do_LocFmt ( char *  buff,
XrdCmsSelected sP,
SMask_t  pf,
SMask_t  wf,
bool  lsall = false,
bool  lsuniq = false 
)
static

Definition at line 659 of file XrdCmsNode.cc.

661 {
662  static const int Skip = (XrdCmsSelected::Disable | XrdCmsSelected::Offline);
663  static const int Hung = (XrdCmsSelected::Disable | XrdCmsSelected::Offline
665  XrdCmsSelected *pP;
666  char *oP = buff;
667 
668 // If only unique entries are wanted then we need to only let through
669 // all non-servers and one server (prefereably a r/w one)
670 //
671 if (!lsall && lsuniq)
672  {XrdCmsSelected *xP = 0;
673  bool haverw = false;
674  pP = sP;
675  while(pP)
676  {if (!(pP->Status & (XrdCmsSelected::isMangr | Skip)))
677  {if (haverw) pP->Status |= Skip;
678  else {if (xP) xP->Status |= Skip;
679  xP = pP;
680  haverw = (pP->Mask & wfVec) != 0;
681  }
682  }
683  pP = pP->next;
684  }
685  }
686 
687 // format out the request as follows:
688 // 01234567810123456789212345678
689 // xy[::123.123.123.123]:123456
690 //
691 if (lsall)
692  while(sP)
693  {*oP = (sP->Status & XrdCmsSelected::isMangr ? 'M' : 'S');
694  if (sP->Status & Hung) *oP = tolower(*oP);
695  *(oP+1) = (sP->Mask & wfVec ? 'w' : 'r');
696  strcpy(oP+2, sP->Ident); oP += sP->IdentLen + 2;
697  if (sP->next) *oP++ = ' ';
698  pP = sP; sP = sP->next; delete pP;
699  }
700  else
701  while(sP)
702  {if (!(sP->Status & Skip))
703  {*oP = (sP->Status & XrdCmsSelected::isMangr ? 'M' : 'S');
704  if (sP->Mask & pfVec) *oP = tolower(*oP);
705  *(oP+1) = (sP->Mask & wfVec ? 'w' : 'r');
706  strcpy(oP+2, sP->Ident); oP += sP->IdentLen + 2;
707  if (sP->next) *oP++ = ' ';
708  }
709  pP = sP; sP = sP->next; delete pP;
710  }
711 
712 // Send of the result
713 //
714  *oP = '\0';
715  return (oP - buff);
716 }
char Ident[IdentSize]
XrdCmsSelected * next

References XrdCmsSelected::Disable, XrdCmsSelected::Ident, XrdCmsSelected::IdentLen, XrdCmsSelected::isMangr, XrdCmsSelected::Mask, XrdCmsSelected::next, XrdCmsSelected::Offline, XrdCmsSelected::Status, and XrdCmsSelected::Suspend.

◆ do_Mkdir()

const char * XrdCmsNode::do_Mkdir ( XrdCmsRRData Arg)

Definition at line 724 of file XrdCmsNode.cc.

725 {
726  EPNAME("do_Mkdir")
727  mode_t mode = 0;
728  int rc;
729 
730 // Do some debugging
731 //
732  DEBUGR("mode " <<Arg.Mode <<' ' <<Arg.Path);
733 
734 // We are don here if we have no data; otherwise convert the mode if we
735 // haven't done so already.
736 //
737  if (!Config.DiskOK) return 0;
738  if (!mode && !getMode(Arg.Mode, mode)) return "invalid mode";
739 
740 // Attempt to create the directory either via call-out of oss plug-in
741 //
742  if (Config.ProgMD) rc = fsExec(Config.ProgMD, Arg.Mode, Arg.Path);
743  else rc = Config.ossFS->Mkdir(Arg.Path, mode);
744 
745 // Return appropriate result
746 //
747  return (rc ? fsFail(Arg.Ident, "mkdir", Arg.Path, rc) : 0);
748 }
int mkdir(const char *path, mode_t mode)

References XrdCms::Config, DEBUGR, XrdCmsConfig::DiskOK, EPNAME, XrdCmsRRData::Ident, XrdOss::Mkdir(), XrdCmsRRData::Mode, XrdCmsConfig::ossFS, XrdCmsRRData::Path, and XrdCmsConfig::ProgMD.

+ Here is the call graph for this function:

◆ do_Mkpath()

const char * XrdCmsNode::do_Mkpath ( XrdCmsRRData Arg)

Definition at line 756 of file XrdCmsNode.cc.

757 {
758  EPNAME("do_Mkpath")
759  mode_t mode = 0;
760  int rc;
761 
762 // Do some debugging
763 //
764  DEBUGR("mode " <<Arg.Mode <<' ' <<Arg.Path);
765 
766 // We are don here if we have no data; otherwise convert the mode if we
767 // haven't done so already.
768 //
769  if (!Config.DiskOK) return 0;
770  if (!mode && !getMode(Arg.Mode, mode)) return "invalid mode";
771 
772 // Attempt to create the directory path via call-out or oss plugin
773 //
774  if (Config.ProgMP) rc = fsExec(Config.ProgMP, Arg.Mode, Arg.Path);
775  else rc = Config.ossFS->Mkdir(Arg.Path, mode, 1);
776 
777 // Return appropriate result
778 //
779  return (rc ? fsFail(Arg.Ident, "mkpath", Arg.Path, rc) : 0);
780 }

References XrdCms::Config, DEBUGR, XrdCmsConfig::DiskOK, EPNAME, XrdCmsRRData::Ident, XrdOss::Mkdir(), XrdCmsRRData::Mode, XrdCmsConfig::ossFS, XrdCmsRRData::Path, and XrdCmsConfig::ProgMP.

+ Here is the call graph for this function:

◆ do_Mv()

const char * XrdCmsNode::do_Mv ( XrdCmsRRData Arg)

Definition at line 788 of file XrdCmsNode.cc.

789 {
790  EPNAME("do_Mv")
791  static const SMask_t allNodes(~0);
792  int rc;
793 
794 // Do some debugging
795 //
796  DEBUGR(Arg.Path <<" to " <<Arg.Path2);
797 
798 // If we are not a server, if must remove references to the old and new names
799 // from our cache. This is independent of how the raname is handled. We need
800 // not back percolate the mv since it was hanled top down in the first place.
801 // Note that we will scuttle the mv if the target file exists somewhere.
802 //
803  if (!Config.DiskOK)
804  {XrdCmsSelect Sel1(XrdCmsSelect::Defer, Arg.Path, strlen(Arg.Path ));
805  XrdCmsSelect Sel2(XrdCmsSelect::Defer, Arg.Path2,strlen(Arg.Path2));
806 
807  // Setup select data (note that mv does not allow fast redirect)
808  //
809  Sel2.iovP = 0; Sel2.iovN = 0;
810  Sel2.InfoP = 0; // No fast redirects
811  Sel2.nmask = SMask_t(0);
812 
813  // Perform selection
814  //
815  if ((rc = Cluster.Select(Sel2)))
816  {if (rc > 0) {Arg.waitVal = rc; return "!mv";}
817  else if (Sel2.Vec.hf)
818  {Say.Emsg("do_Mv",Arg.Path2,"exists; mv failed for",Arg.Path);
819  return "target file exists";
820  }
821  }
822  Cache.DelFile(Sel2, allNodes);
823  Cache.DelFile(Sel1, allNodes);
824  return 0;
825  }
826 
827 // Rename the file via call-out or oss plug-in (we used to do this via a requeue
828 // to the local xrootd but it's no longer necessary).
829 //
830  if (Config.ProgMV) rc = fsExec(Config.ProgMV, Arg.Path, Arg.Path2);
831  else rc = Config.ossFS->Rename(Arg.Path, Arg.Path2);
832 
833 // Return appropriate result
834 //
835  return (rc ? fsFail(Arg.Ident, "mv", Arg.Path, rc) : 0);
836 }
int Select(XrdCmsSelect &Sel)
XrdOss * ossFS
XrdOucProg * ProgMV
virtual int Rename(const char *oPath, const char *nPath, XrdOucEnv *oEnvP=0, XrdOucEnv *nEnvP=0)=0
static INT to(const char *buffer)
Definition: XrdZipUtils.hh:91

References XrdCms::Cache, XrdCms::Cluster, XrdCms::Config, DEBUGR, XrdCmsSelect::Defer, XrdCmsCache::DelFile(), XrdCmsConfig::DiskOK, XrdSysError::Emsg(), EPNAME, XrdCmsRRData::Ident, XrdCmsSelect::InfoP, XrdCmsSelect::iovN, XrdCmsSelect::iovP, XrdCmsSelect::nmask, XrdCmsConfig::ossFS, XrdCmsRRData::Path, XrdCmsRRData::Path2, XrdCmsConfig::ProgMV, XrdOss::Rename(), XrdCms::Say, XrdCmsCluster::Select(), and XrdCmsSelect::Vec.

+ Here is the call graph for this function:

◆ do_Ping()

const char * XrdCmsNode::do_Ping ( XrdCmsRRData Arg)

Definition at line 844 of file XrdCmsNode.cc.

845 {
846  static CmsPongRequest pongIt = {{0, kYR_pong, 0, 0}};
847 
848 // Process: ping
849 // Respond: pong
850 //
851  if (isBad & isDoomed) return ".redirected";
852  Link->Send((char *)&pongIt, sizeof(pongIt));
853  return 0;
854 }
char isBad
Definition: XrdCmsNode.hh:63
static const char isDoomed
Definition: XrdCmsNode.hh:82
@ kYR_pong
Definition: YProtocol.hh:108

References XrdCms::kYR_pong.

◆ do_Pong()

const char * XrdCmsNode::do_Pong ( XrdCmsRRData Arg)

Definition at line 862 of file XrdCmsNode.cc.

863 {
864 // Process: pong
865 // Reponds: n/a
866 
867  return 0;
868 }

◆ do_PrepAdd()

const char * XrdCmsNode::do_PrepAdd ( XrdCmsRRData Arg)

Definition at line 874 of file XrdCmsNode.cc.

875 {
876  EPNAME("do_PrepAdd")
877 
878 // Do some debugging
879 //
880  DEBUGR("parms: " <<Arg.Reqid <<' ' <<Arg.Notify <<' ' <<Arg.Prty <<' '
881  <<Arg.Mode <<' ' <<Arg.Path);
882 
883 // Queue this request for async processing
884 //
885  (new XrdCmsPrepArgs(Arg))->Queue();
886  return 0;
887 }

References DEBUGR, EPNAME, XrdCmsRRData::Mode, XrdCmsRRData::Notify, XrdCmsRRData::Path, XrdCmsRRData::Prty, and XrdCmsRRData::Reqid.

◆ do_PrepDel()

const char * XrdCmsNode::do_PrepDel ( XrdCmsRRData Arg)

Definition at line 893 of file XrdCmsNode.cc.

894 {
895  EPNAME("do_PrepDel")
896 
897 // Do some debugging
898 //
899  DEBUGR("reqid " <<Arg.Reqid);
900 
901 // Cancel the request if applicable.
902 //
903  if (Config.DiskOK)
904  {if (!Config.DiskSS) {DEBUGR("ignoring cancel prepare " <<Arg.Reqid);}
905  else {DEBUGR("canceling prepare " <<Arg.Reqid);
906  PrepQ.Del(Arg.Reqid);
907  }
908  }
909  return 0;
910 }
int Del(char *reqid)

References XrdCms::Config, DEBUGR, XrdCmsPrepare::Del(), XrdCmsConfig::DiskOK, XrdCmsConfig::DiskSS, EPNAME, XrdCms::PrepQ, and XrdCmsRRData::Reqid.

+ Here is the call graph for this function:

◆ do_Rm()

const char * XrdCmsNode::do_Rm ( XrdCmsRRData Arg)

Definition at line 918 of file XrdCmsNode.cc.

919 {
920  EPNAME("do_Rm")
921  static const SMask_t allNodes(~0);
922  int rc;
923 
924 // Do some debugging
925 //
926  DEBUGR(Arg.Path);
927 
928 // If we have no data then we should remove this file from our cache
929 //
930  if (!Config.DiskOK)
931  {XrdCmsSelect Sel(0, Arg.Path, strlen(Arg.Path));
932  Cache.DelFile(Sel, allNodes);
933  return 0;
934  }
935 
936 // Remove the file either via call-out or the oss plugin. We used to requeue
937 // the request to the local xrootd but this is no longer needed.
938 //
939  if (Config.ProgRM) rc = fsExec(Config.ProgRM, Arg.Path);
940  else rc = Config.ossFS->Unlink(Arg.Path);
941 
942 // Return appropriate result
943 //
944  return (rc ? fsFail(Arg.Ident, "rm", Arg.Path, rc) : 0);
945 }
XrdOucProg * ProgRM
virtual int Unlink(const char *path, int Opts=0, XrdOucEnv *envP=0)=0

References XrdCms::Cache, XrdCms::Config, DEBUGR, XrdCmsCache::DelFile(), XrdCmsConfig::DiskOK, EPNAME, XrdCmsRRData::Ident, XrdCmsConfig::ossFS, XrdCmsRRData::Path, XrdCmsConfig::ProgRM, and XrdOss::Unlink().

+ Here is the call graph for this function:

◆ do_Rmdir()

const char * XrdCmsNode::do_Rmdir ( XrdCmsRRData Arg)

Definition at line 953 of file XrdCmsNode.cc.

954 {
955  EPNAME("do_Rmdir")
956  static const SMask_t allNodes(~0);
957  int rc;
958 
959 // Do some debugging
960 //
961  DEBUGR(Arg.Path);
962 
963 // If we have no data then we should remove this directory from our cache
964 //
965  if (!Config.DiskOK)
966  {XrdCmsSelect Sel(0, Arg.Path, strlen(Arg.Path));
967  Cache.DelFile(Sel, allNodes);
968  return 0;
969  }
970 
971 // Remove the directory either via call-out or the oss plug-in (we used to
972 // do this by requeing the request to the local xrootd; no longer needed).
973 //
974  if (Config.ProgRD) rc = fsExec(Config.ProgRD, Arg.Path);
975  else rc = Config.ossFS->Remdir(Arg.Path);
976 
977 // Return appropriate result
978 //
979  return (rc ? fsFail(Arg.Ident, "rmdir", Arg.Path, rc) : 0);
980 }
XrdOucProg * ProgRD
virtual int Remdir(const char *path, int Opts=0, XrdOucEnv *envP=0)=0

References XrdCms::Cache, XrdCms::Config, DEBUGR, XrdCmsCache::DelFile(), XrdCmsConfig::DiskOK, EPNAME, XrdCmsRRData::Ident, XrdCmsConfig::ossFS, XrdCmsRRData::Path, XrdCmsConfig::ProgRD, and XrdOss::Remdir().

+ Here is the call graph for this function:

◆ do_SelAvoid()

int XrdCmsNode::do_SelAvoid ( XrdCmsRRData Arg,
XrdCmsSelect Sel,
char *  Avoid,
bool &  doRedir 
)

Definition at line 986 of file XrdCmsNode.cc.

988 {
989  XrdNetAddr avoidAddr;
990  char *Comma;
991  int avNum = 0;
992 
993 // Process the avoid list
994 //
995  Sel.InfoP = 0;
996  do {if ((Comma = index(Avoid,','))) *Comma = '\0';
997  if (*Avoid == '+') Sel.nmask |= Cluster.getMask(Avoid+1);
998  else if (!avoidAddr.Set(Avoid,0))
999  Sel.nmask |= Cluster.getMask(&avoidAddr);
1000  Avoid = Comma+1; avNum++;
1001  } while(Comma && *Avoid);
1002 
1003 // Check why we have an avoid list. For dfs style clusters, the limits on
1004 // selections are handled by the basefs object.
1005 //
1006  if (baseFS.isDFS())
1007  {if (Arg.Opts & CmsSelectRequest::kYR_tryRSEL)
1009  return 0;
1010  }
1011 
1012 // This is a standard cluster, check if client is expanding the server base
1013 // and whether or not this is allowed in this cluster.
1014 //
1015  if ((Arg.Opts & CmsSelectRequest::kYR_tryMSRC) && !Config.MultiSrc)
1016  {if (Config.msRdrHost)
1017  {strcpy(Sel.Resp.Data, Config.msRdrHost); // Gauranteed to fit!
1018  Sel.Resp.DLen = Config.msRdrHLen;
1019  Sel.Resp.Port = Config.msRdrPort;
1020  doRedir = true;
1021  return -1;
1022  }
1023  strncpy(Sel.Resp.Data, msrcmsg, sizeof(Sel.Resp.Data));
1024  Sel.Resp.DLen = msrclen;
1025  if (Arg.Opts & CmsSelectRequest::kYR_tryRSEL) Sel.Resp.Port = kYR_EPERM;
1026  else Sel.Resp.Port = kYR_ENOENT;
1027  return XrdCmsCluster::EReplete;
1028  }
1029 
1030 // Check if we exceeded the retry count
1031 //
1032  if (avNum > Config.MaxRetries)
1033  {if (Config.mrRdrHost)
1034  {strcpy(Sel.Resp.Data, Config.mrRdrHost); // Gauranteed to fit!
1035  Sel.Resp.DLen = Config.mrRdrHLen;
1036  Sel.Resp.Port = Config.mrRdrPort;
1037  doRedir = true;
1038  } else {
1039  strncpy(Sel.Resp.Data, mtrymsg, sizeof(Sel.Resp.Data));
1040  Sel.Resp.DLen = mtrylen;
1041  }
1042  return -1;
1043  }
1044 
1045 // We suceeded, indicate selection can proceed.
1046 //
1047  return 0;
1048 }
SMask_t getMask(const XrdNetAddr *addr)
static const int EReplete
char * mrRdrHost
char * msRdrHost
struct XrdCmsSelect::@93 Resp
XrdCmsRRQInfo * InfoP
Definition: XrdCmsSelect.hh:47
SMask_t nmask
Definition: XrdCmsSelect.hh:48
const char * Set(const char *hSpec, int pNum=PortInSpec)
Definition: XrdNetAddr.cc:216
@ kYR_EPERM
Definition: YProtocol.hh:151

References XrdCms::baseFS, XrdCms::Cluster, XrdCms::Config, XrdCmsCluster::EReplete, XrdCmsCluster::getMask(), XrdCmsSelect::InfoP, XrdCmsBaseFS::isDFS(), XrdCms::kYR_ENOENT, XrdCms::kYR_EPERM, XrdCms::CmsSelectRequest::kYR_tryMSRC, XrdCms::CmsSelectRequest::kYR_tryRSEL, XrdCmsConfig::MaxRetries, XrdCmsConfig::mrRdrHLen, XrdCmsConfig::mrRdrHost, XrdCmsConfig::mrRdrPort, XrdCmsConfig::msRdrHLen, XrdCmsConfig::msRdrHost, XrdCmsConfig::msRdrPort, XrdCmsConfig::MultiSrc, XrdCmsSelect::nmask, XrdCmsSelect::NoTryLim, XrdCmsRRData::Opts, XrdCmsSelect::Opts, XrdCmsSelect::Resp, and XrdNetAddr::Set().

+ Here is the call graph for this function:

◆ do_Select()

const char * XrdCmsNode::do_Select ( XrdCmsRRData Arg)

Definition at line 1057 of file XrdCmsNode.cc.

1058 {
1059  EPNAME("do_Select")
1060 // kXR_NotFound kXR_IOError kXR_FSError kXR_ServerError
1061  static int rtEC[] = {kYR_ENOENT, kYR_EIO, kYR_FSError, kYR_SrvError};
1062  XrdCmsRRQInfo reqInfo(Instance,RSlot,Arg.Request.streamid,Config.QryMinum);
1063  XrdCmsSelect Sel(XrdCmsSelect::Peers, Arg.Path, Arg.PathLen-1);
1064  struct iovec ioV[2];
1065  char theopts[16], *toP = theopts;
1066  XrdNetIF::ifType ifType;
1067  int rc, bytes;
1068 
1069 // Init select data (note that refresh supresses fast redirects)
1070 //
1071  Sel.iovP = 0; Sel.iovN = 0; Sel.InfoP = &reqInfo;
1072 
1073 // Determine what interface to return to the client
1074 //
1075  ifType = ifVec[(Arg.Opts & CmsSelectRequest::kYR_retipmsk)
1076  >> CmsSelectRequest::kYR_retipsft];
1077  if (Arg.Opts & CmsSelectRequest::kYR_prvtnet)
1078  {XrdNetIF::Privatize(ifType); *toP++='P';}
1079  Sel.Opts |= static_cast<int>(ifType) & XrdCmsSelect::ifWant;
1080 
1081 // Complete the arguments to select
1082 //
1083  if (Arg.Opts & CmsSelectRequest::kYR_refresh)
1084  {Sel.Opts |= XrdCmsSelect::Refresh; *toP++='s';}
1085  if (Arg.Opts & CmsSelectRequest::kYR_online)
1086  {Sel.Opts |= XrdCmsSelect::Online; *toP++='o';}
1087  if (Arg.Opts & CmsSelectRequest::kYR_stat)
1088  {Sel.Opts |= XrdCmsSelect::noBind; *toP++='x';}
1089  else {if (Arg.Opts & CmsSelectRequest::kYR_trunc)
1090  {Sel.Opts |= XrdCmsSelect::Write | XrdCmsSelect::Trunc; *toP++='t';}
1091  if (Arg.Opts & CmsSelectRequest::kYR_write)
1092  {Sel.Opts |= XrdCmsSelect::Write; *toP++='w';
1093  if (Arg.Opts & CmsSelectRequest::kYR_mwfiles || !Config.DoMWChk)
1094  {Sel.Opts |= XrdCmsSelect::MWFiles; *(toP-1)='W';}
1095  }
1096  if (Arg.Opts & CmsSelectRequest::kYR_metaop)
1097  {Sel.Opts |= XrdCmsSelect::isMeta; *toP++='m';
1098  if (!(Arg.Opts & CmsSelectRequest::kYR_write))
1099  {Sel.Opts |= XrdCmsSelect::isDir; *toP++='D';}
1100  }
1101  if (Arg.Opts & CmsSelectRequest::kYR_create)
1102  {Sel.Opts |= XrdCmsSelect::Write|XrdCmsSelect::NewFile; *toP++='c';
1103  if (Arg.Opts & CmsSelectRequest::kYR_replica)
1104  {Sel.Opts |= XrdCmsSelect::Replica; *toP++='+';}
1105  }
1106  }
1107  *toP = '\0';
1108 
1109 // If the client can override selection mode, check if this has been done. Note
1110 // that true packed selection turns off fast redirect.
1111 //
1112  if (Config.sched_Force || !(Arg.Opts & CmsSelectRequest::kYR_aSpec))
1113  {if (Config.sched_Pack)
1114  {Sel.Opts |= XrdCmsSelect::Pack;
1115  if (Config.sched_Pack > 1) Sel.InfoP = 0;
1116  if (!Config.sched_Level) Sel.Opts |= XrdCmsSelect::UseRef;
1117  }
1118  } else {
1119  if (Arg.Opts & CmsSelectRequest::kYR_aPack)
1120  {Sel.Opts |= XrdCmsSelect::Pack;
1121  if (Arg.Opts & CmsSelectRequest::kYR_aWait) Sel.InfoP = 0;
1122  if ((Arg.Opts & CmsSelectRequest::kYR_aPack) ==
1123  CmsSelectRequest::kYR_aStrict)
1124  Sel.Opts |= XrdCmsSelect::UseRef;
1125  }
1126  }
1127 
1128 // Compute alternate hash.
1129 //
1130  if (Sel.Opts & XrdCmsSelect::Pack && Config.sched_AffPC
1131  && Sel.Path.Len > 3) setHash(Sel, Config.sched_AffPC);
1132 
1133 // Check if an avoid node present. If so, this is ineligible for fast redirect.
1134 //
1135  bool doRedir = false;
1136  Sel.nmask = SMask_t(0);
1137  if (Arg.Avoid) rc = do_SelAvoid(Arg, Sel, Arg.Avoid, doRedir);
1138  else rc = 0;
1139 
1140 // Perform selection
1141 //
1142  if (!doRedir && (rc || (rc = Cluster.Select(Sel))))
1143  {if (rc > 0)
1144  {Arg.Request.rrCode = kYR_wait;
1145  Sel.Resp.Port = rc;
1146  Sel.Resp.DLen = 0;
1147  DEBUGR("delay " <<rc <<' ' <<Arg.Path);
1148  } else {
1149  Arg.Request.rrCode = kYR_error;
1150  if (rc != XrdCmsCluster::EReplete) // if error info has not been set
1151  {if (rc == XrdCmsCluster::RetryErr)
1152  {int rtRC = (Arg.Opts & CmsSelectRequest::kYR_tryMASK)
1153  >> CmsSelectRequest::kYR_trySHFT;
1154  Sel.Resp.Port = rtEC[rtRC];
1155  } else {
1156  Sel.Resp.Port = kYR_ENOENT; // This should never happen!
1157  Sel.Resp.DLen = sprintf(Sel.Resp.Data,"%s","Item not found.")+1;
1158  }
1159  }
1160  DEBUGR("failed; " <<Sel.Resp.Data << ' ' <<Arg.Path);
1161  }
1162  } else if (!Sel.Resp.DLen) return 0;
1163  else {Arg.Request.rrCode = kYR_redirect;
1164  DEBUGR("Redirect -> " <<Sel.Resp.Data <<':'
1165  <<Sel.Resp.Port <<" for " <<Arg.Path);
1166  }
1167 
1168 // Format the response
1169 //
1170  bytes = Sel.Resp.DLen+sizeof(Sel.Resp.Port);
1171  Arg.Request.datalen = htons(bytes);
1172  Sel.Resp.Port = htonl(Sel.Resp.Port);
1173 
1174 // Fill out the I/O vector
1175 //
1176  ioV[0].iov_base = (char *)&Arg.Request;
1177  ioV[0].iov_len = sizeof(Arg.Request);
1178  ioV[1].iov_base = (char *)&Sel.Resp;
1179  ioV[1].iov_len = bytes;
1180 
1181 // Send back the response
1182 //
1183  Link->Send(ioV, 2, bytes+sizeof(Arg.Request));
1184  return 0;
1185 }
static const int RetryErr
int do_SelAvoid(XrdCmsRRData &Arg, XrdCmsSelect &Sel, char *Avoid, bool &doRedir)
Definition: XrdCmsNode.cc:986
@ kYR_FSError
Definition: YProtocol.hh:161
@ kYR_EIO
Definition: YProtocol.hh:154
@ kYR_SrvError
Definition: YProtocol.hh:162
@ kYR_redirect
Definition: YProtocol.hh:143
@ kYR_trunc
Definition: YProtocol.hh:113

References XrdCmsRRData::Avoid, XrdCms::Cluster, XrdCms::Config, XrdCms::CmsRRHdr::datalen, DEBUGR, XrdCmsConfig::DoMWChk, EPNAME, XrdCmsCluster::EReplete, XrdCmsSelect::ifWant, XrdCmsSelect::InfoP, XrdCmsSelect::iovN, XrdCmsSelect::iovP, XrdCmsSelect::isDir, XrdCmsSelect::isMeta, XrdCms::CmsSelectRequest::kYR_aPack, XrdCms::CmsSelectRequest::kYR_aSpec, XrdCms::CmsSelectRequest::kYR_aStrict, XrdCms::CmsSelectRequest::kYR_aWait, XrdCms::CmsSelectRequest::kYR_create, XrdCms::kYR_EIO, XrdCms::kYR_ENOENT, XrdCms::kYR_error, XrdCms::kYR_FSError, XrdCms::CmsSelectRequest::kYR_metaop, XrdCms::CmsSelectRequest::kYR_mwfiles, XrdCms::CmsSelectRequest::kYR_online, XrdCms::CmsSelectRequest::kYR_prvtnet, XrdCms::kYR_redirect, XrdCms::CmsSelectRequest::kYR_refresh, XrdCms::CmsSelectRequest::kYR_replica, XrdCms::CmsSelectRequest::kYR_retipmsk, XrdCms::CmsSelectRequest::kYR_retipsft, XrdCms::kYR_SrvError, XrdCms::CmsSelectRequest::kYR_stat, XrdCms::CmsSelectRequest::kYR_trunc, XrdCms::CmsSelectRequest::kYR_tryMASK, XrdCms::CmsSelectRequest::kYR_trySHFT, XrdCms::kYR_wait, XrdCms::CmsSelectRequest::kYR_write, XrdCmsKey::Len, XrdCmsSelect::MWFiles, XrdCmsSelect::NewFile, XrdCmsSelect::nmask, XrdCmsSelect::noBind, XrdCmsSelect::Online, XrdCmsRRData::Opts, XrdCmsSelect::Opts, XrdCmsSelect::Pack, XrdCmsRRData::Path, XrdCmsSelect::Path, XrdCmsRRData::PathLen, XrdCmsSelect::Peers, XrdNetIF::Privatize(), XrdCmsConfig::QryMinum, XrdCmsSelect::Refresh, XrdCmsSelect::Replica, XrdCmsRRData::Request, XrdCmsSelect::Resp, XrdCmsCluster::RetryErr, XrdCms::CmsRRHdr::rrCode, XrdCmsConfig::sched_AffPC, XrdCmsConfig::sched_Force, XrdCmsConfig::sched_Level, XrdCmsConfig::sched_Pack, XrdCmsCluster::Select(), XrdCms::CmsRRHdr::streamid, XrdCmsSelect::Trunc, XrdCmsSelect::UseRef, and XrdCmsSelect::Write.

+ Here is the call graph for this function:

◆ do_SelPrep()

int XrdCmsNode::do_SelPrep ( XrdCmsPrepArgs Arg)
static

Definition at line 1191 of file XrdCmsNode.cc.

1192 {
1193  EPNAME("do_SelPrep")
1194  XrdCmsSelect Sel(XrdCmsSelect::Peers, Arg.path, Arg.pathlen-1);
1195  int rc;
1196 
1197 // Complete the arguments to select
1198 //
1199  if ( Arg.options & CmsPrepAddRequest::kYR_fresh)
1200  Sel.Opts |= XrdCmsSelect::Freshen;
1201  if ( Arg.options & CmsPrepAddRequest::kYR_write)
1202  Sel.Opts |= XrdCmsSelect::Write;
1203  if (Arg.options & CmsPrepAddRequest::kYR_stage)
1204  {Sel.iovP = Arg.ioV; Sel.iovN = Arg.iovNum;}
1205  else {Sel.iovP = 0; Sel.iovN = 0;
1206  Sel.Opts |= XrdCmsSelect::Defer;
1207  }
1208 
1209 // Setup select data (note that prepare does not allow fast redirect)
1210 //
1211  Sel.InfoP = 0; // No fast redirects
1212  Sel.nmask = SMask_t(0);
1213 
1214 // We do not care what interface is being used. This may conflict with a
1215 // staging prepare but it's too complicated to handle at this point.
1216 //
1217  Sel.Opts |= static_cast<char>(XrdNetIF::ifAny);
1218 
1219 // Check if co-location wanted relevant only when staging wanted
1220 //
1221  if (Arg.clPath && Sel.iovP)
1222  {XrdCmsSelect Scl(XrdCmsSelect::Peers, Arg.clPath, strlen(Arg.clPath));
1223  Scl.iovP = 0; Scl.iovN = 0; Scl.InfoP = 0; Scl.nmask = SMask_t(0);
1224  DEBUGR("colocating " <<Arg.path <<" w.r.t. " <<Arg.clPath);
1225  rc = Cluster.Select(Scl);
1226  if (rc > 0) {Sched->Schedule((XrdJob *)&Arg, rc+time(0));
1227  DEBUGR("coloc to " <<Arg.clPath <<" delayed " <<rc <<" seconds");
1228  return 1;
1229  }
1230  if (rc < 0) Say.Emsg("SelPrep", Arg.path, "failed;", Sel.Resp.Data);
1231  else Sel.nmask = ~Scl.smask;
1232  }
1233 
1234 // Perform selection
1235 //
1236  if ((rc = Cluster.Select(Sel)))
1237  {if (rc > 0)
1238  {if (!(Arg.options & CmsPrepAddRequest::kYR_stage)) return 0;
1239  Sched->Schedule((XrdJob *)&Arg, rc+time(0));
1240  DEBUGR("prep delayed " <<rc <<" seconds");
1241  return 1;
1242  }
1243  Say.Emsg("SelPrep", Arg.path, "failed;", Sel.Resp.Data);
1244  PrepQ.Inform("unavail", &Arg);
1245  }
1246 
1247 // All done
1248 //
1249  return 0;
1250 }
struct iovec ioV[iovNum]
static const int iovNum
void Inform(const char *cmd, XrdCmsPrepArgs *pargs)
Definition: XrdJob.hh:43
void Schedule(XrdJob *jp)
XrdScheduler Sched
Definition: XrdLinkCtl.cc:54

References XrdCmsPrepArgs::clPath, XrdCms::Cluster, DEBUGR, XrdCmsSelect::Defer, XrdSysError::Emsg(), EPNAME, XrdCmsSelect::Freshen, XrdNetIF::ifAny, XrdCmsSelect::InfoP, XrdCmsPrepare::Inform(), XrdCmsPrepArgs::ioV, XrdCmsSelect::iovN, XrdCmsPrepArgs::iovNum, XrdCmsSelect::iovP, XrdCms::CmsPrepAddRequest::kYR_fresh, XrdCms::CmsPrepAddRequest::kYR_stage, XrdCms::CmsPrepAddRequest::kYR_write, XrdCmsSelect::nmask, XrdCmsPrepArgs::options, XrdCmsSelect::Opts, XrdCmsPrepArgs::path, XrdCmsPrepArgs::pathlen, XrdCmsSelect::Peers, XrdCms::PrepQ, XrdCmsSelect::Resp, XrdCms::Say, XrdCms::Sched, XrdScheduler::Schedule(), XrdCmsCluster::Select(), XrdCmsSelect::smask, and XrdCmsSelect::Write.

Referenced by XrdCmsPrepArgs::DoIt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_Space()

const char * XrdCmsNode::do_Space ( XrdCmsRRData Arg)

Definition at line 1258 of file XrdCmsNode.cc.

1259 {
1260  EPNAME("do_Space")
1261  struct iovec xmsg[2];
1262  CmsAvailRequest mySpace = {{0, kYR_avail, 0, 0}};
1263  char buff[sizeof(int)*2+2], *bp = buff;
1264  int blen, maxfr, tutil;
1265 
1266 // Process: <id> space
1267 // Respond: <id> avail <numkb> <dskutil>
1268 //
1269  maxfr = Meter.FreeSpace(tutil);
1270 
1271 // Do some debugging
1272 //
1273  DEBUGR(maxfr <<"MB free; " <<tutil <<"% util");
1274 
1275 // Construct a message to be sent to the manager.
1276 //
1277  blen = XrdOucPup::Pack(&bp, maxfr);
1278  blen += XrdOucPup::Pack(&bp, tutil);
1279  mySpace.Hdr.datalen = htons(static_cast<unsigned short>(blen));
1280 
1281 // Send the response
1282 //
1283  if (Arg.Request.rrCode != kYR_space)
1284  XrdCmsManager::Inform(mySpace.Hdr, buff, blen);
1285  else {xmsg[0].iov_base = (char *)&mySpace;
1286  xmsg[0].iov_len = sizeof(mySpace);
1287  xmsg[1].iov_base = buff;
1288  xmsg[1].iov_len = blen;
1289  mySpace.Hdr.datalen = htons(static_cast<unsigned short>(blen));
1290  Link->Send(xmsg, 2);
1291  }
1292  return 0;
1293 }
int FreeSpace(int &tutil)
Definition: XrdCmsMeter.cc:158
static int Pack(struct iovec **, const char *, unsigned short &buff)
Definition: XrdOucPup.cc:52
@ kYR_space
Definition: YProtocol.hh:109
@ kYR_avail
Definition: YProtocol.hh:102

References DEBUGR, EPNAME, XrdCmsMeter::FreeSpace(), XrdCmsManager::Inform(), XrdCms::kYR_avail, XrdCms::kYR_space, XrdCms::Meter, XrdOucPup::Pack(), XrdCmsRRData::Request, and XrdCms::CmsRRHdr::rrCode.

+ Here is the call graph for this function:

◆ do_State()

const char * XrdCmsNode::do_State ( XrdCmsRRData Arg)

Definition at line 1301 of file XrdCmsNode.cc.

1302 {
1303  EPNAME("do_State")
1304  struct iovec xmsg[2];
1305  int rc, noResp = Arg.Request.modifier & CmsStateRequest::kYR_noresp;
1306 
1307 // Do some debugging
1308 //
1309  TRACER(Files,Arg.Path);
1310 
1311 // Process: state <path>
1312 // Respond: have <path>
1313 //
1314  isKnown = 1;
1315 
1316 // If we are a manager then check for the file in the local cache. Otherwise,
1317 // ask the underlying filesystem whether it has the file.
1318 //
1319  if (isMan) {if(!(Arg.Request.modifier = do_StateFWD(Arg))) return 0;}
1320  else if (!Config.DiskOK && !Config.asProxy()) return 0;
1321  else if (baseFS.Limit() && Arg.Request.modifier&CmsStateRequest::kYR_metaman)
1322  {XrdCmsPInfo pinfo;
1323  pinfo.rovec = NodeMask;
1324  if ((rc = baseFS.Exists(Arg,pinfo)) > 0) Arg.Request.modifier = rc;
1325  else return 0;
1326  }
1327  else if ((rc = baseFS.Exists(Arg.Path, -(Arg.PathLen-1))) > 0)
1328  Arg.Request.modifier = rc;
1329  else return 0;
1330 
1331 // Respond appropriately
1332 //
1333  if (Arg.Request.modifier && !noResp)
1334  {TRACER(Files,Arg.Path <<" responding have!");
1335  xmsg[0].iov_base = (char *)&Arg.Request;
1336  xmsg[0].iov_len = sizeof(Arg.Request);
1337  xmsg[1].iov_base = Arg.Buff;
1338  xmsg[1].iov_len = Arg.Dlen;
1339  Arg.Request.rrCode = kYR_have;
1340  Arg.Request.modifier |= kYR_raw;
1341  Link->Send(xmsg, 2);
1342  }
1343  return 0;
1344 }
int Exists(XrdCmsRRData &Arg, XrdCmsPInfo &Who, int noLim=0)
int do_StateFWD(XrdCmsRRData &Arg)
Definition: XrdCmsNode.cc:1403
char isKnown
Definition: XrdCmsNode.hh:70
char isMan
Definition: XrdCmsNode.hh:67
kXR_char modifier
Definition: YProtocol.hh:85
@ kYR_raw
Definition: YProtocol.hh:132
@ kYR_have
Definition: YProtocol.hh:105

References XrdCmsConfig::asProxy(), XrdCms::baseFS, XrdCmsRRData::Buff, XrdCms::Config, XrdCmsConfig::DiskOK, XrdCmsRRData::Dlen, EPNAME, XrdCmsBaseFS::Exists(), XrdCms::kYR_have, XrdCms::CmsStateRequest::kYR_metaman, XrdCms::CmsStateRequest::kYR_noresp, XrdCms::kYR_raw, XrdCmsBaseFS::Limit(), XrdCms::CmsRRHdr::modifier, XrdCmsRRData::Path, XrdCmsRRData::PathLen, XrdCmsRRData::Request, XrdCmsPInfo::rovec, XrdCms::CmsRRHdr::rrCode, and TRACER.

+ Here is the call graph for this function:

◆ do_StateDFS()

void XrdCmsNode::do_StateDFS ( XrdCmsBaseFR rP,
int  rc 
)
static

Definition at line 106 of file XrdCmsConfig.cc.

◆ do_StateFWD()

int XrdCmsNode::do_StateFWD ( XrdCmsRRData Arg)

Definition at line 1403 of file XrdCmsNode.cc.

1404 {
1405  EPNAME("do_StateFWD");
1406  static const SMask_t allNodes(~0);
1407  XrdCmsSelect Sel(0, Arg.Path, Arg.PathLen-1);
1408  XrdCmsPInfo pinfo;
1409  int retc;
1410 
1411 // Find out who could serve this file
1412 //
1413  if (!Cache.Paths.Find(Arg.Path, pinfo) || pinfo.rovec == 0)
1414  {DEBUGR("Path find failed for state " <<Arg.Path);
1415  return 0;
1416  }
1417 
1418 // Get the primary locations for this file
1419 //
1420  Sel.Vec.hf = Sel.Vec.pf = Sel.Vec.bf = 0;
1421  if (Arg.Request.modifier & CmsStateRequest::kYR_refresh) retc = 0;
1422  else retc = Cache.GetFile(Sel, pinfo.rovec);
1423 
1424 // If we will possibly be forwarding this request we indicate here whether this
1425 // is a request from a meta-manager. Making the decision in the manager node
1426 // prevents the requestor from lying about its status.
1427 //
1428  if (!retc && !Config.asServer())
1429  Arg.Request.modifier |= CmsStateRequest::kYR_metaman;
1430 
1431 // Here we process the case where we need to discover whether the file exists.
1432 // For distributed file systems, we either ask the underlying file system here
1433 // or forward the request to some arbitrary node in a callback via the baseFS.
1434 // If cached information exists, pending status takes precedence (more below).
1435 // Additionally, if a query is alrady in progress, deep-six this attempt.
1436 //
1437  if (baseFS.isDFS())
1438  {if (retc < 0) return 0;
1439  if (!retc)
1440  {if (baseFS.Traverse())
1441  {Cache.AddFile(Sel, 0);
1442  Cluster.Broadsend(pinfo.rovec, Arg.Request, Arg.Buff, Arg.Dlen);
1443  return 0;
1444  }
1445  if ((retc = baseFS.Exists(Arg, pinfo)) <= 0)
1446  {if (retc < 0) Cache.AddFile(Sel, 0);
1447  return 0;
1448  }
1449  Sel.Opts=(retc == CmsHaveRequest::Pending ? XrdCmsSelect::Pending:0);
1450  Sel.Vec.hf = pinfo.rovec; Sel.Vec.wf = pinfo.rwvec;
1451  Cache.AddFile(Sel, allNodes);
1452  return retc;
1453  }
1454  if (Sel.Vec.pf != 0) return CmsHaveRequest::Pending;
1455  if (Sel.Vec.hf != 0) return CmsHaveRequest::Online;
1456  return 0;
1457  }
1458 
1459 // For shared-nothing setups, first check if we need to ask any unasked nodes
1460 // whether they have the file.
1461 //
1462  if (!retc || Sel.Vec.bf != 0)
1463  {if (!retc) Cache.AddFile(Sel, 0);
1464  Cluster.Broadcast((retc ? Sel.Vec.bf : pinfo.rovec), Arg.Request,
1465  (void *)Arg.Buff, Arg.Dlen);
1466  }
1467 
1468 // Return true if anyone has the file at this point. In shared-nothing systems
1469 // we are interested in some node has the file in non-pending status. This
1470 // differs from shared-everything because pending status applies to all nodes.
1471 //
1472  if (Sel.Vec.hf != 0) return CmsHaveRequest::Online;
1473  if (Sel.Vec.pf != 0){return CmsHaveRequest::Pending;}
1474  return 0;
1475 }
int GetFile(XrdCmsSelect &Sel, SMask_t mask)
Definition: XrdCmsCache.cc:232
XrdCmsPList_Anchor Paths
Definition: XrdCmsCache.hh:49
int Broadsend(SMask_t smask, XrdCms::CmsRRHdr &Hdr, void *Data, int Dlen)
SMask_t Broadcast(SMask_t, const struct iovec *, int, int tot=0)
int Find(const char *pname, XrdCmsPInfo &masks)
Definition: XrdCmsPList.cc:77

References XrdCmsCache::AddFile(), XrdCmsConfig::asServer(), XrdCms::baseFS, XrdCmsCluster::Broadcast(), XrdCmsCluster::Broadsend(), XrdCmsRRData::Buff, XrdCms::Cache, XrdCms::Cluster, XrdCms::Config, DEBUGR, XrdCmsRRData::Dlen, EPNAME, XrdCmsBaseFS::Exists(), XrdCmsPList_Anchor::Find(), XrdCmsCache::GetFile(), XrdCmsBaseFS::isDFS(), XrdCms::CmsStateRequest::kYR_metaman, XrdCms::CmsStateRequest::kYR_refresh, XrdCms::CmsRRHdr::modifier, XrdCms::CmsHaveRequest::Online, XrdCmsSelect::Opts, XrdCmsRRData::Path, XrdCmsRRData::PathLen, XrdCmsCache::Paths, XrdCms::CmsHaveRequest::Pending, XrdCmsSelect::Pending, XrdCmsRRData::Request, XrdCmsPInfo::rovec, XrdCmsPInfo::rwvec, XrdCmsBaseFS::Traverse(), and XrdCmsSelect::Vec.

+ Here is the call graph for this function:

◆ do_StatFS()

const char * XrdCmsNode::do_StatFS ( XrdCmsRRData Arg)

Definition at line 1481 of file XrdCmsNode.cc.

1482 {
1483  static kXR_unt32 Zero = 0;
1484  char buff[256];
1485  struct iovec ioV[3] = {{(char *)&Arg.Request, sizeof(Arg.Request)},
1486  {(char *)&Zero, sizeof(Zero)},
1487  {(char *)&buff, 0}};
1488  XrdCmsPInfo pinfo;
1489  int bytes;
1490  SpaceData theSpace;
1491 
1492 // Find out who serves this path and get space relative to it
1493 //
1494  if (Cache.Paths.Find(Arg.Path, pinfo) && pinfo.rovec)
1495  {Cluster.Space(theSpace, pinfo.rovec);
1496  if (Arg.Request.modifier & CmsStatfsRequest::kYR_qvfs)
1497  {bytes = sprintf(buff, "A %lld %lld %d",
1498  theSpace.Total, theSpace.TotFr,
1499  (theSpace.wFree < theSpace.sFree ? theSpace.sFree
1500  : theSpace.wFree)) + 1;
1501  } else {
1502  bytes = sprintf(buff, "%d %d %d %d %d %d",
1503  theSpace.wNum, theSpace.wFree, theSpace.wUtil,
1504  theSpace.sNum, theSpace.sFree, theSpace.sUtil) + 1;
1505  }
1506  } else bytes = strlcpy(buff, "-1 -1 -1 -1 -1 -1", sizeof(buff)) + 1;
1507 
1508 // Send the response
1509 //
1510  ioV[2].iov_len = bytes;
1511  bytes += sizeof(Zero);
1512  Arg.Request.rrCode = kYR_data;
1513  Arg.Request.datalen = htons(bytes);
1514  Link->Send(ioV, 3, bytes+sizeof(Arg.Request));
1515  return 0;
1516 }
void Space(XrdCms::SpaceData &sData, SMask_t smask)

References XrdCms::Cache, XrdCms::Cluster, XrdCms::CmsRRHdr::datalen, XrdCmsPList_Anchor::Find(), XrdCms::kYR_data, XrdCms::CmsStatfsRequest::kYR_qvfs, XrdCms::CmsRRHdr::modifier, XrdCmsRRData::Path, XrdCmsCache::Paths, XrdCmsRRData::Request, XrdCmsPInfo::rovec, XrdCms::CmsRRHdr::rrCode, XrdCms::SpaceData::sFree, XrdCms::SpaceData::sNum, XrdCmsCluster::Space(), strlcpy(), XrdCms::SpaceData::sUtil, XrdCms::SpaceData::Total, XrdCms::SpaceData::TotFr, XrdCms::SpaceData::wFree, XrdCms::SpaceData::wNum, and XrdCms::SpaceData::wUtil.

+ Here is the call graph for this function:

◆ do_Stats()

const char * XrdCmsNode::do_Stats ( XrdCmsRRData Arg)

Definition at line 1524 of file XrdCmsNode.cc.

1525 {
1526  static const unsigned short szLen = sizeof(kXR_unt32);
1527  static XrdSysMutex StatsData;
1528  static int statsz = 0;
1529  static int statln = 0;
1530  static char *statbuff = 0;
1531  static time_t statlast = 0;
1532  static kXR_unt32 theSize;
1533 
1534  struct iovec ioV[3] = {{(char *)&Arg.Request, sizeof(Arg.Request)},
1535  {(char *)&theSize, sizeof(theSize)},
1536  {0, 0}
1537  };
1538  time_t tNow;
1539 
1540 // Allocate buffer if we do not have one
1541 //
1542  StatsData.Lock();
1543  if (!statsz || !statbuff)
1544  {statsz = Cluster.Stats(0,0);
1545  statbuff = (char *)malloc(statsz);
1546  theSize = htonl(statsz);
1547  }
1548 
1549 // Check if only the size is wanted
1550 //
1551  if (Arg.Request.modifier & CmsStatsRequest::kYR_size)
1552  {ioV[1].iov_len = sizeof(theSize);
1553  Arg.Request.datalen = htons(szLen);
1554  Arg.Request.rrCode = kYR_data;
1555  Link->Send(ioV, 2);
1556  StatsData.UnLock();
1557  return 0;
1558  }
1559 
1560 // Get full statistics if enough time has passed
1561 //
1562  tNow = time(0);
1563  if (statlast+9 >= tNow)
1564  {statln = Cluster.Stats(statbuff, statsz); statlast = tNow;}
1565 
1566 // Format result and send response
1567 //
1568  ioV[2].iov_base = statbuff;
1569  ioV[2].iov_len = statln;
1570  Arg.Request.datalen = htons(static_cast<unsigned short>(szLen+statln));
1571  Arg.Request.rrCode = kYR_data;
1572  Link->Send(ioV, 3);
1573 
1574 // All done
1575 //
1576  StatsData.UnLock();
1577  return 0;
1578 }
int Stats(char *bfr, int bln)

References XrdCms::Cluster, XrdCms::CmsRRHdr::datalen, XrdCms::kYR_data, XrdCms::CmsStatsRequest::kYR_size, XrdSysMutex::Lock(), XrdCms::CmsRRHdr::modifier, XrdCmsRRData::Request, XrdCms::CmsRRHdr::rrCode, XrdCmsCluster::Stats(), and XrdSysMutex::UnLock().

+ Here is the call graph for this function:

◆ do_Status()

const char * XrdCmsNode::do_Status ( XrdCmsRRData Arg)

Definition at line 1589 of file XrdCmsNode.cc.

1590 {
1591  EPNAME("do_Status")
1592  const char *srvMsg, *stgMsg;
1593  int Stage = Arg.Request.modifier & CmsStatusRequest::kYR_Stage;
1594  int noStage = Arg.Request.modifier & CmsStatusRequest::kYR_noStage;
1595  int Resume = Arg.Request.modifier & CmsStatusRequest::kYR_Resume;
1596  int Suspend = Arg.Request.modifier & CmsStatusRequest::kYR_Suspend;
1597  int Reset = Arg.Request.modifier & CmsStatusRequest::kYR_Reset;
1598  int add2Activ, add2Stage, port;
1599 
1600 // Do some debugging
1601 //
1602  DEBUGR( (Reset ? "reset " : "")
1603  <<(Resume ? "resume " : (Suspend ? "suspend " : ""))
1604  <<(Stage ? "stage " : (noStage ? "nostage " : "")));
1605 
1606 // Process reset requests. These are exclsuive to any other request
1607 //
1608  if (Reset)
1609  {XrdCmsManager::Reset(); // Propagate the reset to our managers
1610  Cache.Bounce(NodeMask, NodeID); // Now invalidate our cache lines
1611  }
1612 
1613 // Process stage/nostage
1614 //
1615  if ((Stage && isNoStage) || (noStage && !isNoStage))
1616  if (noStage) {add2Stage = -1; isNoStage = 1; stgMsg="staging suspended";}
1617  else {add2Stage = 1; isNoStage = 0; stgMsg="staging resumed";}
1618  else {add2Stage = 0; stgMsg = 0;}
1619 
1620 // Process suspend/resume. We mmerely need a read lock to alter isBad here.
1621 //
1622  if ((Resume && (isBad & isSuspend)) || (Suspend && !(isBad & isSuspend)))
1623  if (Suspend) {add2Activ = -1;
1624  Cluster.SLock(true, false);
1625  isBad |= isSuspend; // Keep coherency with black listing
1626  Cluster.SLock(false);
1627  srvMsg="service suspended";
1628  stgMsg = 0;
1629  }
1630  else {add2Activ = 1;
1631  Cluster.SLock(true, false);
1632  isBad &= ~isSuspend; // Keep coherency with black listing
1633  Cluster.SLock(false);
1634  srvMsg="service resumed";
1635  stgMsg = (isNoStage ? "(no staging)" : "(staging)");
1636  port = ntohl(Arg.Request.streamid);
1637  if (port && port != netIF.Port())
1638  {Lock(); netIF.Port(port); UnLock();
1639  DEBUGR("set data port to " <<port);
1640  }
1641  }
1642  else {add2Activ = 0; srvMsg = 0;}
1643 
1644 // Get the most important message out (advisory isOffline doen't need STMutex)
1645 //
1646  if (isOffline) {srvMsg = "service offline"; stgMsg = 0;}
1647  else if (isBad & isDisabled) {srvMsg = "service disabled"; stgMsg = 0;}
1648  else if (isBad & isBlisted ) {srvMsg = "service blacklisted"; stgMsg = 0;}
1649 
1650 // Now see if we need to change anything
1651 //
1652  if (add2Activ || add2Stage)
1653  {CmsState.Update(XrdCmsState::Counts, add2Activ, add2Stage);
1654  Say.Emsg("Node", Name(), srvMsg, stgMsg);
1655  }
1656 
1657  return 0;
1658 }
void Bounce(SMask_t smask, int SNum)
Definition: XrdCmsCache.cc:343
void SLock(bool dolock, bool wrmode=true)
static void Reset()
void Lock()
Definition: XrdCmsNode.hh:175
static const char isDisabled
Definition: XrdCmsNode.hh:80
static const char isSuspend
Definition: XrdCmsNode.hh:81
char isNoStage
Definition: XrdCmsNode.hh:66
void UnLock()
Definition: XrdCmsNode.hh:177
static const char isBlisted
Definition: XrdCmsNode.hh:79
void Update(StateType StateT, int ActivVal, int StageVal=0)
Definition: XrdCmsState.cc:258
int Port()
Definition: XrdNetIF.hh:322
XrdCmsState CmsState
Definition: XrdCmsState.cc:55

References XrdCmsCache::Bounce(), XrdCms::Cache, XrdCms::Cluster, XrdCms::CmsState, XrdCmsState::Counts, DEBUGR, XrdSysError::Emsg(), EPNAME, XrdCms::CmsStatusRequest::kYR_noStage, XrdCms::CmsStatusRequest::kYR_Reset, XrdCms::CmsStatusRequest::kYR_Resume, XrdCms::CmsStatusRequest::kYR_Stage, XrdCms::CmsStatusRequest::kYR_Suspend, XrdCms::CmsRRHdr::modifier, XrdCmsRRData::Request, XrdCmsManager::Reset(), XrdCms::Say, XrdCmsCluster::SLock(), XrdCms::CmsRRHdr::streamid, and XrdCmsState::Update().

+ Here is the call graph for this function:

◆ do_Trunc()

const char * XrdCmsNode::do_Trunc ( XrdCmsRRData Arg)

Definition at line 1666 of file XrdCmsNode.cc.

1667 {
1668  EPNAME("do_Trunc")
1669  long long Size = -1;
1670  int rc;
1671 
1672 // Do some debugging
1673 //
1674  DEBUGR("size " <<Arg.Mode <<' ' <<Arg.Path);
1675 
1676 // We are don here if we have no data; otherwise convert the mode if we
1677 // haven't done so already.
1678 //
1679  if (!Config.DiskOK) return 0;
1680  if (Size < 0 && !getSize(Arg.Mode, Size)) return "invalid size";
1681 
1682 // Attempt to change the size either via call-out or the oss plug-in
1683 //
1684  if (Config.ProgTR) rc = fsExec(Config.ProgTR, Arg.Mode, Arg.Path);
1685  else rc = Config.ossFS->Truncate(Arg.Path, Size);
1686 
1687 // Return appropriate result
1688 //
1689  return (rc ? fsFail(Arg.Ident, "trunc", Arg.Path, rc) : 0);
1690 }
TruncateImpl< false > Truncate(Ctx< File > file, Arg< uint64_t > size, uint16_t timeout)

References XrdCms::Config, DEBUGR, XrdCmsConfig::DiskOK, EPNAME, XrdCmsRRData::Ident, XrdCmsRRData::Mode, XrdCmsConfig::ossFS, XrdCmsRRData::Path, XrdCmsConfig::ProgTR, and XrdOss::Truncate().

+ Here is the call graph for this function:

◆ do_Try()

const char * XrdCmsNode::do_Try ( XrdCmsRRData Arg)

Definition at line 1700 of file XrdCmsNode.cc.

1701 {
1702  EPNAME("do_Try")
1703 
1704 // Do somde debugging
1705 //
1706  DEBUGR(Arg.Path);
1707 
1708 // Add all the alternates to our alternate list
1709 //
1710  if (Manager) Manager->myMans->Add(&netID, Arg.Path, Config.PortTCP, myLevel);
1711 
1712 // Close the link and return an error
1713 //
1714 // Disc("redirected.");
1715  return ".redirected";
1716 }

References XrdCms::Config, DEBUGR, EPNAME, XrdCmsRRData::Path, and XrdCmsConfig::PortTCP.

◆ do_Update()

const char * XrdCmsNode::do_Update ( XrdCmsRRData Arg)

Definition at line 1722 of file XrdCmsNode.cc.

1723 {
1724 
1725 // Process: <id> update
1726 // Respond: <id> status
1727 //
1728  CmsState.sendState(Link);
1729  return 0;
1730 }
void sendState(XrdLink *Link)
Definition: XrdCmsState.cc:161

References XrdCms::CmsState, and XrdCmsState::sendState().

+ Here is the call graph for this function:

◆ do_Usage()

const char * XrdCmsNode::do_Usage ( XrdCmsRRData Arg)

Definition at line 1738 of file XrdCmsNode.cc.

1739 {
1740 
1741 // Process: <id> usage
1742 // Respond: <id> load <cpu> <io> <load> <mem> <pag> <dskfree> <dskutil>
1743 //
1744  Report_Usage(Link);
1745  return 0;
1746 }
static void Report_Usage(XrdLink *lp)
Definition: XrdCmsNode.cc:1752

◆ g2nLock()

void XrdCmsNode::g2nLock ( XrdSysRWLock gMutex)
inline

Definition at line 162 of file XrdCmsNode.hh.

163  {refCnt++; // Keep node alive during transition
164  gMutex.UnLock(); // The lock must have ben held
165  nodeMutex.Lock(); // Downgrade to node lock
166  }

References XrdSysMutex::Lock(), and XrdSysRWLock::UnLock().

Referenced by XrdCmsCluster::BlackList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSlot()

short XrdCmsNode::getSlot ( )
inline

Definition at line 208 of file XrdCmsNode.hh.

208 {return RSlot;}

◆ ID()

int XrdCmsNode::ID ( int &  INum)
inline

Definition at line 139 of file XrdCmsNode.hh.

139 {INum = Instance; return NodeID;}

Referenced by XrdCmsClustID::AddNode(), XrdCmsCluster::Remove(), and XrdCmsManager::Remove().

+ Here is the caller graph for this function:

◆ inDomain()

bool XrdCmsNode::inDomain ( )
inline

Definition at line 143 of file XrdCmsNode.hh.

143 {return netIF.InDomain(&netID);}
static bool InDomain(XrdNetAddrInfo *epaddr)
Definition: XrdNetIF.cc:622

References XrdNetIF::InDomain().

+ Here is the call graph for this function:

◆ Inst()

int XrdCmsNode::Inst ( )
inline

Definition at line 141 of file XrdCmsNode.hh.

141 {return Instance;}

◆ isNode() [1/3]

int XrdCmsNode::isNode ( const XrdNetAddr addr)
inline

Definition at line 147 of file XrdCmsNode.hh.

148  {return netID.Same(addr);}
int Same(const XrdNetAddrInfo *ipAddr, bool plusPort=false)

References XrdNetAddrInfo::Same().

+ Here is the call graph for this function:

◆ isNode() [2/3]

int XrdCmsNode::isNode ( SMask_t  smask)
inline

Definition at line 145 of file XrdCmsNode.hh.

145 {return (smask & NodeMask) != 0;}

Referenced by XrdCmsCluster::Broadcast(), XrdCmsCluster::Broadsend(), XrdCmsCluster::getMask(), XrdCmsCluster::ResetRef(), and XrdCmsCluster::Space().

+ Here is the caller graph for this function:

◆ isNode() [3/3]

int XrdCmsNode::isNode ( XrdLink lp,
const char *  nid,
int  port 
)
inline

Definition at line 150 of file XrdCmsNode.hh.

151  {if (nid)
152  {if (strcmp(myNID, nid)) return 0;
153  if (*nid == '*') return 1;
154  }
155  return netID.Same(lp->NetAddr()) && port == netIF.Port();
156  }

References XrdLink::NetAddr(), XrdNetIF::Port(), and XrdNetAddrInfo::Same().

+ Here is the call graph for this function:

◆ Lock()

void XrdCmsNode::Lock ( )
inline

Definition at line 175 of file XrdCmsNode.hh.

175 {refCnt++; nodeMutex.Lock();}

References XrdSysMutex::Lock().

Referenced by XrdCmsCluster::Add(), XrdCmsManager::Add(), XrdCmsManager::Inform(), XrdCmsCluster::Remove(), and XrdCmsManager::Reset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Mask()

SMask_t XrdCmsNode::Mask ( )
inline

Definition at line 160 of file XrdCmsNode.hh.

160 {return NodeMask;}

Referenced by XrdCmsClustID::AddNode(), XrdCmsCluster::Broadcast(), and XrdCmsClustID::RemNode().

+ Here is the caller graph for this function:

◆ n2gLock()

void XrdCmsNode::n2gLock ( XrdSysRWLock gMutex,
bool  rdlock = false 
)
inline

Definition at line 168 of file XrdCmsNode.hh.

169  {nodeMutex.UnLock(); // Release this node
170  refCnt--; // OK for node to go away
171  if (rdlock) gMutex.ReadLock();
172  else gMutex.WriteLock();
173  }

References XrdSysRWLock::ReadLock(), XrdSysMutex::UnLock(), and XrdSysRWLock::WriteLock().

Referenced by XrdCmsCluster::BlackList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Name()

char* XrdCmsNode::Name ( )
inline

Definition at line 158 of file XrdCmsNode.hh.

158 {return (myName ? myName : (char *)"?");}

Referenced by XrdCmsManager::Add(), XrdCmsClustID::AddNode(), XrdCmsCluster::BlackList(), XrdCmsManager::Inform(), XrdCmsManager::Remove(), and XrdCmsManager::Reset().

+ Here is the caller graph for this function:

◆ Ref()

void XrdCmsNode::Ref ( )
inline

Definition at line 179 of file XrdCmsNode.hh.

179 {refCnt++;} // Must have global or node locked!

Referenced by XrdCmsCluster::Broadcast(), XrdCmsCluster::Broadsend(), and XrdCmsCluster::Remove().

+ Here is the caller graph for this function:

◆ Report_Usage()

void XrdCmsNode::Report_Usage ( XrdLink lp)
static

Definition at line 1752 of file XrdCmsNode.cc.

1753 {
1754  EPNAME("Report_Usage")
1755  CmsLoadRequest myLoad = {{0, kYR_load, 0, 0}};
1756  struct iovec xmsg[2];
1757  char loadbuff[CmsLoadRequest::numLoad];
1758  char respbuff[sizeof(loadbuff)+2+sizeof(int)+2], *bp = respbuff;
1759  int blen, maxfr, pcpu, pnet, pxeq, pmem, ppag, pdsk;
1760 
1761 // Respond: <id> load <cpu> <io> <load> <mem> <pag> <dskfree> <dskutil>
1762 //
1763  maxfr = Meter.Report(pcpu, pnet, pxeq, pmem, ppag, pdsk);
1764 
1765  loadbuff[CmsLoadRequest::cpuLoad] = static_cast<char>(pcpu);
1766  loadbuff[CmsLoadRequest::netLoad] = static_cast<char>(pnet);
1767  loadbuff[CmsLoadRequest::xeqLoad] = static_cast<char>(pxeq);
1768  loadbuff[CmsLoadRequest::memLoad] = static_cast<char>(pmem);
1769  loadbuff[CmsLoadRequest::pagLoad] = static_cast<char>(ppag);
1770  loadbuff[CmsLoadRequest::dskLoad] = static_cast<char>(pdsk);
1771 
1772  blen = XrdOucPup::Pack(&bp, loadbuff, sizeof(loadbuff));
1773  blen += XrdOucPup::Pack(&bp, maxfr);
1774  myLoad.Hdr.datalen = htons(static_cast<unsigned short>(blen));
1775 
1776  xmsg[0].iov_base = (char *)&myLoad;
1777  xmsg[0].iov_len = sizeof(myLoad);
1778  xmsg[1].iov_base = respbuff;
1779  xmsg[1].iov_len = blen;
1780  if (lp) lp->Send(xmsg, 2);
1781  else XrdCmsManager::Inform("usage", xmsg, 2);
1782 
1783 // Do some debugging
1784 //
1785  DEBUG("cpu=" <<pcpu <<" net=" <<pnet <<" xeq=" <<pxeq
1786  <<" mem=" <<pmem <<" pag=" <<ppag <<" dsk=" <<pdsk <<' ' <<maxfr);
1787 }
int Report(int &pcpu, int &pnet, int &pxeq, int &pmem, int &ppag, int &pdsk)
Definition: XrdCmsMeter.cc:374
@ kYR_load
Definition: YProtocol.hh:106

References XrdCms::CmsLoadRequest::cpuLoad, XrdCms::CmsRRHdr::datalen, DEBUG, XrdCms::CmsLoadRequest::dskLoad, EPNAME, XrdCms::CmsLoadRequest::Hdr, XrdCmsManager::Inform(), XrdCms::kYR_load, XrdCms::CmsLoadRequest::memLoad, XrdCms::Meter, XrdCms::CmsLoadRequest::netLoad, XrdCms::CmsLoadRequest::numLoad, XrdOucPup::Pack(), XrdCms::CmsLoadRequest::pagLoad, XrdCmsMeter::Report(), XrdLink::Send(), and XrdCms::CmsLoadRequest::xeqLoad.

Referenced by XrdCmsMeter::PutInfo(), and XrdCmsMeter::Update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Send() [1/2]

int XrdCmsNode::Send ( const char *  buff,
int  blen = 0 
)
inline

Definition at line 184 of file XrdCmsNode.hh.

185  {return (isOffline ? -1 : Link->Send(buff, blen));}

References isOffline, and XrdLink::Send().

Referenced by XrdCmsCluster::BlackList(), XrdCmsCluster::Broadcast(), XrdCmsCluster::Broadsend(), XrdCmsManager::Inform(), and XrdCmsManager::Reset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Send() [2/2]

int XrdCmsNode::Send ( const struct iovec *  iov,
int  iovcnt,
int  iotot = 0 
)
inline

Definition at line 186 of file XrdCmsNode.hh.

187  {return (isOffline ? -1 : Link->Send(iov, iovcnt, iotot));}

References isOffline, and XrdLink::Send().

+ Here is the call graph for this function:

◆ setManager()

void XrdCmsNode::setManager ( XrdCmsManager mP)
inline

Definition at line 189 of file XrdCmsNode.hh.

189 {Manager = mP;}

Referenced by XrdCmsManager::Add().

+ Here is the caller graph for this function:

◆ setName()

void XrdCmsNode::setName ( XrdLink lnkp,
const char *  theIF,
int  port 
)

Definition at line 145 of file XrdCmsNode.cc.

146 {
147  char buff[512];
148  const char *hname = lnkp->Host();
149 
150 // Check if this is a duplicate. Note that we check for strict equivalence.
151 //
152  if (myName)
153  {if (!strcmp(myName,hname) && port == netIF.Port()
154  && netID.Same(lnkp->NetAddr())) return;
155  free(myName);
156  }
157 
158 // Get our address information but substitute data port for actual port
159 //
160  netID = *(lnkp->NetAddr());
161 
162 // Set the network interface. Note that out of domain nodes are not allowed
163 // to specify interface addresses as this does not make global sense.
164 //
165  if (theIF && !netIF.InDomain(&netID)) theIF = 0;
166  netIF.SetIF(&netID, theIF, port);
167  hasNet = netIF.Mask();
168 
169  netIF.SetPublicName(hname);
170 
171 // Construct our identification
172 //
173  myName = strdup(hname);
174  myNlen = strlen(hname);
175 
176  if (!port) strcpy(buff, lnkp->ID);
177  else sprintf(buff, "%s:%d", lnkp->ID, port);
178  if (Ident) free(Ident);
179  Ident = strdup(buff);
180 }
char hasNet
Definition: XrdCmsNode.hh:62
char Mask()
Definition: XrdNetIF.hh:288
bool SetIF(XrdNetAddrInfo *src, const char *ifList, int port=0, netType nettype=netDefault, const char *xName=0)
Definition: XrdNetIF.cc:704
bool SetPublicName(const std::string &name)
Definition: XrdNetIF.hh:164

References XrdLink::Host(), XrdLink::ID, and XrdLink::NetAddr().

Referenced by XrdCmsCluster::Add().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShare()

void XrdCmsNode::setShare ( int  shrval)
inline

Definition at line 193 of file XrdCmsNode.hh.

194  {if (shrval > 99) Shrem = Shrip = Share = 0;
195  else {Shrem = Share = shrval; Shrip = 100 - shrval;}
196  }

◆ setSlot()

void XrdCmsNode::setSlot ( short  rslot)
inline

Definition at line 207 of file XrdCmsNode.hh.

207 {RSlot = rslot;}

◆ setTZone()

int XrdCmsNode::setTZone ( int  tZone)
inline

Definition at line 198 of file XrdCmsNode.hh.

199  {TimeZone = tZone & 0x0f;
200  if (tZone & 0x10) TimeZone = -TimeZone;
201  TZValid = (tZone != 0);
202  return TimeZone;
203  }
char TZValid
Definition: XrdCmsNode.hh:77
char TimeZone
Definition: XrdCmsNode.hh:76

References TimeZone, and TZValid.

◆ setVersion()

void XrdCmsNode::setVersion ( unsigned short  vnum)
inline

Definition at line 205 of file XrdCmsNode.hh.

205 {myVersion = vnum;}

References XrdCms::myVersion.

◆ ShowIF()

void XrdCmsNode::ShowIF ( )
inline

Definition at line 210 of file XrdCmsNode.hh.

210 {netIF.Display("=====> ");}
void Display(const char *pfx="=====> ")
Definition: XrdNetIF.cc:142

References XrdNetIF::Display().

+ Here is the call graph for this function:

◆ SyncSpace()

void XrdCmsNode::SyncSpace ( )

Definition at line 1793 of file XrdCmsNode.cc.

1794 {
1795  XrdCmsRRData Arg;
1796  int old_free = 0;
1797 
1798 // For newly logged in nodes, we need to sync the free space stats
1799 //
1800  mlMutex.Lock();
1801  if (isRW && DiskFree > LastFree)
1802  {old_free = LastFree; LastFree = DiskFree;}
1803  mlMutex.UnLock();
1804 
1805 // Tell our manager if we now have more space, if need be.
1806 //
1807  if (!old_free)
1808  {Arg.Request.rrCode = kYR_login;
1809  Arg.Ident = Ident;
1810  Arg.dskFree = DiskFree;
1811  Arg.dskUtil = DiskUtil;
1812  do_Space(Arg);
1813  }
1814 }
@ kYR_login
Definition: YProtocol.hh:90

References XrdCmsRRData::dskFree, XrdCmsRRData::Ident, XrdCms::kYR_login, XrdCmsRRData::Request, and XrdCms::CmsRRHdr::rrCode.

◆ UnLock()

void XrdCmsNode::UnLock ( )
inline

Definition at line 177 of file XrdCmsNode.hh.

177 {nodeMutex.UnLock(); refCnt--;}

References XrdSysMutex::UnLock().

Referenced by XrdCmsRTable::Add(), XrdCmsManager::Inform(), XrdCmsCluster::Remove(), and XrdCmsManager::Reset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unRef()

void XrdCmsNode::unRef ( )
inline

Definition at line 180 of file XrdCmsNode.hh.

180 {refCnt--;}

Referenced by XrdCmsCluster::Broadcast(), XrdCmsCluster::Broadsend(), and XrdCmsCluster::Remove().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ XrdCmsCluster

friend class XrdCmsCluster
friend

Definition at line 59 of file XrdCmsNode.hh.

Member Data Documentation

◆ allowsRW

const char XrdCmsNode::allowsRW = 0x01
static

Definition at line 84 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Space().

◆ allowsSS

const char XrdCmsNode::allowsSS = 0x02
static

Definition at line 85 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Space().

◆ ConfigID

unsigned int XrdCmsNode::ConfigID = 0

Definition at line 92 of file XrdCmsNode.hh.

◆ DiskFree

int XrdCmsNode::DiskFree = 0

Definition at line 90 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Select(), and XrdCmsCluster::Space().

◆ DiskMinF

int XrdCmsNode::DiskMinF = 0

Definition at line 89 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Select(), and XrdCmsCluster::Space().

◆ DiskNums

int XrdCmsNode::DiskNums = 0

Definition at line 88 of file XrdCmsNode.hh.

◆ DiskTotal

unsigned int XrdCmsNode::DiskTotal = 0

Definition at line 87 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Space().

◆ DiskUtil

int XrdCmsNode::DiskUtil = 0

Definition at line 91 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Space().

◆ hasNet

char XrdCmsNode::hasNet = 0

Definition at line 62 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Select().

◆ Ident

◆ isBad

◆ isBlisted

const char XrdCmsNode::isBlisted = 0x01
static

◆ isBound

char XrdCmsNode::isBound = 0

Definition at line 69 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Add(), XrdCmsManager::Add(), and XrdCmsCluster::Remove().

◆ isConn

char XrdCmsNode::isConn = 0

Definition at line 71 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Add(), XrdCmsManager::Add(), and XrdCmsCluster::Remove().

◆ isDisabled

const char XrdCmsNode::isDisabled = 0x02
static

Definition at line 80 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Add(), and XrdCmsCluster::List().

◆ isDoomed

const char XrdCmsNode::isDoomed = 0x08
static

◆ isGone

char XrdCmsNode::isGone = 0

Definition at line 72 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Remove().

◆ isKnown

char XrdCmsNode::isKnown = 0

Definition at line 70 of file XrdCmsNode.hh.

Referenced by XrdCmsManager::Reset().

◆ isMan

char XrdCmsNode::isMan = 0

◆ isNoStage

char XrdCmsNode::isNoStage = 0

◆ isOffline

◆ isPeer

char XrdCmsNode::isPeer = 0

Definition at line 68 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Add(), and XrdCmsClustID::RemNode().

◆ isPerm

char XrdCmsNode::isPerm = 0

Definition at line 73 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Add().

◆ isRW

char XrdCmsNode::isRW = 0

Definition at line 65 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::List(), and XrdCmsCluster::Space().

◆ isSuspend

const char XrdCmsNode::isSuspend = 0x04
static

Definition at line 81 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::Add(), XrdCmsCluster::List(), and XrdCmsCluster::Remove().

◆ RoleID

char XrdCmsNode::RoleID = 0

Definition at line 75 of file XrdCmsNode.hh.

Referenced by XrdCmsCluster::List().

◆ rsvd

char XrdCmsNode::rsvd = 0

Definition at line 74 of file XrdCmsNode.hh.

◆ TimeZone

char XrdCmsNode::TimeZone = 0

Definition at line 76 of file XrdCmsNode.hh.

Referenced by setTZone().

◆ TZValid

char XrdCmsNode::TZValid = 0

Definition at line 77 of file XrdCmsNode.hh.

Referenced by setTZone().


The documentation for this class was generated from the following files: