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 184 of file XrdCmsNode.cc.

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

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

285 {
286  EPNAME("do_Avail")
287 
288 // Process: avail <fsdsk> <util>
289 //
290  DiskFree = Arg.dskFree;
291  DiskUtil = static_cast<int>(Arg.dskUtil);
292 
293 // Do some debugging
294 //
295  DEBUGR(DiskFree <<"MB free; " <<DiskUtil <<"% util");
296  return 0;
297 }
#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 305 of file XrdCmsNode.cc.

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

340 {
341 
342 // Indicate we have received a disconnect
343 //
344  Say.Emsg("Node", Link->Name(), "requested a disconnect");
345 
346 // If we must send a disc request, do so now
347 //
348  if (Config.asManager()) Link->Send((char *)&Arg.Request,sizeof(Arg.Request));
349 
350 // Close the link and return an error
351 //
352  isOffline = 1; // STMutex not needed here
353  Link->Close(1);
354  return "."; // Signal disconnect
355 }
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 364 of file XrdCmsNode.cc.

365 {
366  EPNAME("do_Gone")
367  static const SMask_t allNodes(~0);
368  int newgone;
369 
370 // Do some debugging
371 //
372  TRACER(Files,Arg.Path);
373 
374 // Update path information and delete this from the prep queue if we are a
375 // staging node. We can also be called via the admin end-point interface
376 // In this case, we have no cache and simply forward up the request.
377 //
378  if (Config.asManager())
380  newgone = Cache.DelFile(Sel, baseFS.isDFS() ? allNodes : NodeMask);
381  } else {
382  newgone = 1;
383  if (Config.DiskSS) PrepQ.Gone(Arg.Path);
384  }
385 
386 // If we have no managers and we still have the file or never had it, return
387 //
388  if (!XrdCmsManager::Present() || !newgone) return 0;
389 
390 // Back-propogate the gone to all of our managers
391 //
392  XrdCmsManager::Inform(Arg.Request, Arg.Buff, Arg.Dlen);
393 
394 // All done
395 //
396  return 0;
397 }
#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: XrdCmsCache.cc:54
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 406 of file XrdCmsNode.cc.

407 {
408  EPNAME("do_Have")
409  static const SMask_t allNodes(~0);
410  XrdCmsPInfo pinfo;
411  int isnew, Opts;
412 
413 // Do some debugging
414 //
415  TRACER(Files, (Arg.Request.modifier&CmsHaveRequest::Pending ? "P ":"")
416  <<Arg.Path);
417 
418 // Find if we can handle the file in r/w mode and if staging is present
419 //
420  Opts = (Cache.Paths.Find(Arg.Path, pinfo) && (pinfo.rwvec & NodeMask)
421  ? XrdCmsSelect::Write : 0);
422  if (Arg.Request.modifier & CmsHaveRequest::Pending)
423  Opts |= XrdCmsSelect::Pending;
424 
425 // Update path information. If we are exporting a shared-everything file system
426 // then we need to also provide the cache the current list of nodes and how
427 // they export the path in question for fast redispatch processing.
428 //
429  if (!Config.asManager()) isnew = 1;
431  Sel.Path.Hash = Arg.Request.streamid;
432  if (baseFS.isDFS())
433  {Sel.Vec.hf = pinfo.rovec; Sel.Vec.wf = pinfo.rwvec;
434  isnew = Cache.AddFile(Sel, allNodes);
435  } else isnew = Cache.AddFile(Sel, NodeMask);
436  }
437 
438 // Return if we have no managers or we already informed the managers
439 //
440  if (!XrdCmsManager::Present() || !isnew) return 0;
441 
442 // Back-propogate the have to all of our managers
443 //
444  XrdCmsManager::Inform(Arg.Request, Arg.Buff, Arg.Dlen);
445 
446 // All done
447 //
448  return 0;
449 }
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
WriteImpl< false > Write(Ctx< File > file, Arg< uint64_t > offset, Arg< uint32_t > size, Arg< const void * > buffer, uint16_t timeout=0)
Factory for creating WriteImpl objects.
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 457 of file XrdCmsNode.cc.

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

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

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

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

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

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 786 of file XrdCmsNode.cc.

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

843 {
844  static CmsPongRequest pongIt = {{0, kYR_pong, 0, 0}};
845 
846 // Process: ping
847 // Respond: pong
848 //
849  if (isBad & isDoomed) return ".redirected";
850  Link->Send((char *)&pongIt, sizeof(pongIt));
851  return 0;
852 }
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 860 of file XrdCmsNode.cc.

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

◆ do_PrepAdd()

const char * XrdCmsNode::do_PrepAdd ( XrdCmsRRData Arg)

Definition at line 872 of file XrdCmsNode.cc.

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

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 891 of file XrdCmsNode.cc.

892 {
893  EPNAME("do_PrepDel")
894 
895 // Do some debugging
896 //
897  DEBUGR("reqid " <<Arg.Reqid);
898 
899 // Cancel the request if applicable.
900 //
901  if (Config.DiskOK)
902  {if (!Config.DiskSS) {DEBUGR("ignoring cancel prepare " <<Arg.Reqid);}
903  else {DEBUGR("canceling prepare " <<Arg.Reqid);
904  PrepQ.Del(Arg.Reqid);
905  }
906  }
907  return 0;
908 }
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 916 of file XrdCmsNode.cc.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

◆ do_Update()

const char * XrdCmsNode::do_Update ( XrdCmsRRData Arg)

Definition at line 1720 of file XrdCmsNode.cc.

1721 {
1722 
1723 // Process: <id> update
1724 // Respond: <id> status
1725 //
1726  CmsState.sendState(Link);
1727  return 0;
1728 }
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 1736 of file XrdCmsNode.cc.

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

◆ 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:606

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 1750 of file XrdCmsNode.cc.

1751 {
1752  EPNAME("Report_Usage")
1753  CmsLoadRequest myLoad = {{0, kYR_load, 0, 0}};
1754  struct iovec xmsg[2];
1755  char loadbuff[CmsLoadRequest::numLoad];
1756  char respbuff[sizeof(loadbuff)+2+sizeof(int)+2], *bp = respbuff;
1757  int blen, maxfr, pcpu, pnet, pxeq, pmem, ppag, pdsk;
1758 
1759 // Respond: <id> load <cpu> <io> <load> <mem> <pag> <dskfree> <dskutil>
1760 //
1761  maxfr = Meter.Report(pcpu, pnet, pxeq, pmem, ppag, pdsk);
1762 
1763  loadbuff[CmsLoadRequest::cpuLoad] = static_cast<char>(pcpu);
1764  loadbuff[CmsLoadRequest::netLoad] = static_cast<char>(pnet);
1765  loadbuff[CmsLoadRequest::xeqLoad] = static_cast<char>(pxeq);
1766  loadbuff[CmsLoadRequest::memLoad] = static_cast<char>(pmem);
1767  loadbuff[CmsLoadRequest::pagLoad] = static_cast<char>(ppag);
1768  loadbuff[CmsLoadRequest::dskLoad] = static_cast<char>(pdsk);
1769 
1770  blen = XrdOucPup::Pack(&bp, loadbuff, sizeof(loadbuff));
1771  blen += XrdOucPup::Pack(&bp, maxfr);
1772  myLoad.Hdr.datalen = htons(static_cast<unsigned short>(blen));
1773 
1774  xmsg[0].iov_base = (char *)&myLoad;
1775  xmsg[0].iov_len = sizeof(myLoad);
1776  xmsg[1].iov_base = respbuff;
1777  xmsg[1].iov_len = blen;
1778  if (lp) lp->Send(xmsg, 2);
1779  else XrdCmsManager::Inform("usage", xmsg, 2);
1780 
1781 // Do some debugging
1782 //
1783  DEBUG("cpu=" <<pcpu <<" net=" <<pnet <<" xeq=" <<pxeq
1784  <<" mem=" <<pmem <<" pag=" <<ppag <<" dsk=" <<pdsk <<' ' <<maxfr);
1785 }
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 // Construct our identification
170 //
171  myName = strdup(hname);
172  myNlen = strlen(hname);
173 
174  if (!port) strcpy(buff, lnkp->ID);
175  else sprintf(buff, "%s:%d", lnkp->ID, port);
176  if (Ident) free(Ident);
177  Ident = strdup(buff);
178 }
char hasNet
Definition: XrdCmsNode.hh:62
char Mask()
Definition: XrdNetIF.hh:242
bool SetIF(XrdNetAddrInfo *src, const char *ifList, int port=0, netType nettype=netDefault, const char *xName=0)
Definition: XrdNetIF.cc:688

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 1791 of file XrdCmsNode.cc.

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