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

Commit ea9e382

Browse files
dlherms-ibmtgooding
authored andcommitted
bb:Ensure that the bbServer metadata is on a parallel file system
1 parent 154cc2d commit ea9e382

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

bb/src/bbinternal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const int RESUME = 0;
110110
const int SUSPEND = 1;
111111

112112
const bool DEFAULT_USE_DISCARD_ON_MOUNT_OPTION = false;
113+
const bool DEFAULT_REQUIRE_BBSERVER_METADATA_ON_PARALLEL_FILE_SYSTEM = true;
113114

114115
const uint64_t DEFAULT_JOBID = 1;
115116
const uint64_t NO_JOBID = 0;

bb/src/bbwrkqmgr.cc

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ FL_SetSize(FLError, 16384)
3636
FL_SetName(FLAsyncRqst, "Async Request Flightlog")
3737
FL_SetSize(FLAsyncRqst, 16384)
3838

39+
#ifndef GPFS_SUPER_MAGIC
40+
#define GPFS_SUPER_MAGIC 0x47504653
41+
#endif
42+
3943

4044
/*
4145
* Static data
@@ -44,6 +48,49 @@ static int asyncRequestFile_ReadSeqNbr = 0;
4448
static FILE* asyncRequestFile_Read = (FILE*)0;
4549

4650

51+
/*
52+
* Helper methods
53+
*/
54+
int isGpfsFile(const char* pFileName, bool& pValue)
55+
{
56+
ENTRY(__FILE__,__FUNCTION__);
57+
int rc = 0;
58+
stringstream errorText;
59+
60+
pValue = false;
61+
struct statfs l_Statbuf;
62+
63+
bfs::path l_Path(pFileName);
64+
rc = statfs(pFileName, &l_Statbuf);
65+
while ((rc) && ((errno == ENOENT)))
66+
{
67+
l_Path = l_Path.parent_path();
68+
if (l_Path.string() == "")
69+
{
70+
break;
71+
}
72+
rc = statfs(l_Path.string().c_str(), &l_Statbuf);
73+
}
74+
75+
if (rc)
76+
{
77+
FL_Write(FLServer, StatfsFailedGpfs, "Statfs failed", 0, 0 ,0, 0);
78+
errorText << "Unable to statfs file " << l_Path.string();
79+
LOG_ERROR_TEXT_ERRNO(errorText, errno);
80+
}
81+
82+
if((l_Statbuf.f_type == GPFS_SUPER_MAGIC))
83+
{
84+
pValue = true;
85+
}
86+
87+
FL_Write(FLServer, Statfs_isGpfsFile, "rc=%ld, isGpfsFile=%ld, magic=%lx", rc, pValue, l_Statbuf.f_type, 0);
88+
89+
EXIT(__FILE__,__FUNCTION__);
90+
return rc;
91+
}
92+
93+
4794
/*
4895
* Static methods
4996
*/
@@ -1690,6 +1737,35 @@ int WRKQMGR::verifyAsyncRequestFile(char* &pAsyncRequestFileName, int &pSeqNbr,
16901737
{
16911738
if (pMaintenanceOption == START_BBSERVER)
16921739
{
1740+
// Ensure that the bbServer metadata is on a parallel file system
1741+
// NOTE: We invoke isGpfsFile() even if we are not to enforce the condition so that
1742+
// we flightlog the statfs() result...
1743+
bool l_GpfsMount = false;
1744+
rc = isGpfsFile(pAsyncRequestFileName, l_GpfsMount);
1745+
if (!rc)
1746+
{
1747+
if (!l_GpfsMount)
1748+
{
1749+
if (config.get("bb.requireMetadataOnParallelFileSystem", DEFAULT_REQUIRE_BBSERVER_METADATA_ON_PARALLEL_FILE_SYSTEM))
1750+
{
1751+
rc = -1;
1752+
errorText << "bbServer metadata is required to be on a parallel file system. Current data store path is " << l_DataStorePath \
1753+
<< ". Set bb.bbserverMetadataPath properly in the configuration.";
1754+
bberror << err("error.asyncRequestFile", pAsyncRequestFileName);
1755+
LOG_ERROR_TEXT_ERRNO_AND_BAIL(errorText, rc);
1756+
}
1757+
else
1758+
{
1759+
LOG(bb,info) << "WRKQMGR: bbServer metadata is NOT on a parallel file system, but is currently allowed";
1760+
}
1761+
}
1762+
}
1763+
else
1764+
{
1765+
// bberror was filled in...
1766+
BAIL;
1767+
}
1768+
16931769
// Unconditionally perform a chown to root:root for the cross-bbServer metatdata root directory.
16941770
rc = chown(l_DataStorePath.c_str(), 0, 0);
16951771
if (rc)

0 commit comments

Comments
 (0)