Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
bb:Ensure that the bbServer metadata is on a parallel file system
Browse files Browse the repository at this point in the history
  • Loading branch information
dlherms-ibm authored and tgooding committed Jan 17, 2019
1 parent 154cc2d commit ea9e382
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions bb/src/bbinternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const int RESUME = 0;
const int SUSPEND = 1;

const bool DEFAULT_USE_DISCARD_ON_MOUNT_OPTION = false;
const bool DEFAULT_REQUIRE_BBSERVER_METADATA_ON_PARALLEL_FILE_SYSTEM = true;

const uint64_t DEFAULT_JOBID = 1;
const uint64_t NO_JOBID = 0;
Expand Down
76 changes: 76 additions & 0 deletions bb/src/bbwrkqmgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ FL_SetSize(FLError, 16384)
FL_SetName(FLAsyncRqst, "Async Request Flightlog")
FL_SetSize(FLAsyncRqst, 16384)

#ifndef GPFS_SUPER_MAGIC
#define GPFS_SUPER_MAGIC 0x47504653
#endif


/*
* Static data
Expand All @@ -44,6 +48,49 @@ static int asyncRequestFile_ReadSeqNbr = 0;
static FILE* asyncRequestFile_Read = (FILE*)0;


/*
* Helper methods
*/
int isGpfsFile(const char* pFileName, bool& pValue)
{
ENTRY(__FILE__,__FUNCTION__);
int rc = 0;
stringstream errorText;

pValue = false;
struct statfs l_Statbuf;

bfs::path l_Path(pFileName);
rc = statfs(pFileName, &l_Statbuf);
while ((rc) && ((errno == ENOENT)))
{
l_Path = l_Path.parent_path();
if (l_Path.string() == "")
{
break;
}
rc = statfs(l_Path.string().c_str(), &l_Statbuf);
}

if (rc)
{
FL_Write(FLServer, StatfsFailedGpfs, "Statfs failed", 0, 0 ,0, 0);
errorText << "Unable to statfs file " << l_Path.string();
LOG_ERROR_TEXT_ERRNO(errorText, errno);
}

if((l_Statbuf.f_type == GPFS_SUPER_MAGIC))
{
pValue = true;
}

FL_Write(FLServer, Statfs_isGpfsFile, "rc=%ld, isGpfsFile=%ld, magic=%lx", rc, pValue, l_Statbuf.f_type, 0);

EXIT(__FILE__,__FUNCTION__);
return rc;
}


/*
* Static methods
*/
Expand Down Expand Up @@ -1690,6 +1737,35 @@ int WRKQMGR::verifyAsyncRequestFile(char* &pAsyncRequestFileName, int &pSeqNbr,
{
if (pMaintenanceOption == START_BBSERVER)
{
// Ensure that the bbServer metadata is on a parallel file system
// NOTE: We invoke isGpfsFile() even if we are not to enforce the condition so that
// we flightlog the statfs() result...
bool l_GpfsMount = false;
rc = isGpfsFile(pAsyncRequestFileName, l_GpfsMount);
if (!rc)
{
if (!l_GpfsMount)
{
if (config.get("bb.requireMetadataOnParallelFileSystem", DEFAULT_REQUIRE_BBSERVER_METADATA_ON_PARALLEL_FILE_SYSTEM))
{
rc = -1;
errorText << "bbServer metadata is required to be on a parallel file system. Current data store path is " << l_DataStorePath \
<< ". Set bb.bbserverMetadataPath properly in the configuration.";
bberror << err("error.asyncRequestFile", pAsyncRequestFileName);
LOG_ERROR_TEXT_ERRNO_AND_BAIL(errorText, rc);
}
else
{
LOG(bb,info) << "WRKQMGR: bbServer metadata is NOT on a parallel file system, but is currently allowed";
}
}
}
else
{
// bberror was filled in...
BAIL;
}

// Unconditionally perform a chown to root:root for the cross-bbServer metatdata root directory.
rc = chown(l_DataStorePath.c_str(), 0, 0);
if (rc)
Expand Down

0 comments on commit ea9e382

Please sign in to comment.