Commit 82d984ab authored by Christian Mohrbacher's avatar Christian Mohrbacher

updated to release 6.11

parent 454b464a
......@@ -163,6 +163,7 @@ CXXFLAGS_DEBUG = -O1 -D_FORTIFY_SOURCE=2 \
LDFLAGS = -std=c++0x \
-rdynamic \
-pthread -lrt \
-Wl,-rpath,'$$ORIGIN/../lib' \
$(USER_LDFLAGS)
ifeq ($(BEEGFS_DEBUG),)
......@@ -311,7 +312,7 @@ else
endif
ifneq ($(realpath $(BEEGFS_THIRDPARTY_PATH)/build/libssl.a),)
$(info [NOTE] Using packages OpenSSL)
$(info [NOTE] Using packaged OpenSSL)
$(call define-dep-lib, openssl,\
-isystem $(OPENSSL_INC_PATH),\
$(BEEGFS_THIRDPARTY_PATH)/build/libssl.a $(BEEGFS_THIRDPARTY_PATH)/build/libcrypto.a)
......
......@@ -334,6 +334,16 @@ sysACLsEnabled = false
# Note: Enabling this setting can affect metadata performance.
# Default: false
# [sysRenameEbusyAsXdev]
# Changes the semantics of rename() to return an EXDEV error if a file could not
# be moved because it is in use (instead of the default EBUSY). Applications and
# tools like mv can handle EXDEV and fall back to copy/unlink for the files.
# This is mostly useful for NFS exports, where files may not be closed by the
# server until after the last open file handle has been closed by clients. This
# can cause spurious EBUSY errors in clients that close a file and rename it
# immediately afterwards.
# Default: false
#
# --- Section 4.5: [Tuning] ---
#
......
......@@ -230,6 +230,7 @@ void _Config_loadDefaults(Config* this)
_Config_configMapRedefine(this, "sysACLsEnabled", "false");
_Config_configMapRedefine(this, "quotaEnabled", "false");
_Config_configMapRedefine(this, "sysRenameEbusyAsXdev", "false");
}
bool _Config_applyConfigMap(Config* this, bool enableException)
......@@ -499,6 +500,9 @@ bool _Config_applyConfigMap(Config* this, bool enableException)
if(!strcmp(keyStr, "sysACLsEnabled") )
this->sysACLsEnabled = StringTk_strToBool(valueStr);
else
if (!strcmp(keyStr, "sysRenameEbusyAsXdev"))
this->sysRenameEbusyAsXdev = StringTk_strToBool(valueStr);
else
if(!strcmp(keyStr, "quotaEnabled") )
this->quotaEnabled = StringTk_strToBool(valueStr);
else
......
......@@ -233,6 +233,8 @@ struct Config
bool quotaEnabled;
/* workaround for rename of closed files on nfs */
bool sysRenameEbusyAsXdev;
// internals
......
......@@ -13,7 +13,8 @@ AckStoreMapIter AckStoreMap_find(AckStoreMap* this, const char* searchKey)
AckStoreMapIter AckStoreMap_begin(AckStoreMap* this)
{
RBTreeElem* treeElem = container_of(rb_first(&this->rbTree.treeroot), RBTreeElem, treenode);
struct rb_node* node = rb_first(&this->rbTree.treeroot);
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
AckStoreMapIter iter;
AckStoreMapIter_init(&iter, this, treeElem);
......
......@@ -13,7 +13,8 @@ WaitAckMapIter WaitAckMap_find(WaitAckMap* this, const char* searchKey)
WaitAckMapIter WaitAckMap_begin(WaitAckMap* this)
{
RBTreeElem* treeElem = container_of(rb_first(&this->rbTree.treeroot), RBTreeElem, treenode);
struct rb_node* node = rb_first(&this->rbTree.treeroot);
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
WaitAckMapIter iter;
WaitAckMapIter_init(&iter, this, treeElem);
......
......@@ -14,7 +14,8 @@ IntMapIter IntMap_find(IntMap* this, const int searchKey)
IntMapIter IntMap_begin(IntMap* this)
{
RBTreeElem* treeElem = container_of(rb_first(&this->rbTree.treeroot), RBTreeElem, treenode);
struct rb_node* node = rb_first(&this->rbTree.treeroot);
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
IntMapIter iter;
IntMapIter_init(&iter, this, treeElem);
......
......@@ -15,7 +15,8 @@ MirrorBuddyGroupMapIter MirrorBuddyGroupMap_find(MirrorBuddyGroupMap* this,
MirrorBuddyGroupMapIter MirrorBuddyGroupMap_begin(MirrorBuddyGroupMap* this)
{
RBTreeElem* treeElem = container_of(rb_first(&this->rbTree.treeroot), RBTreeElem, treenode);
struct rb_node* node = rb_first(&this->rbTree.treeroot);
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
MirrorBuddyGroupMapIter iter;
MirrorBuddyGroupMapIter_init(&iter, this, treeElem);
......
......@@ -14,7 +14,8 @@ RBTreeIter PointerRBTree_find(RBTree* this, const void* searchKey)
RBTreeIter PointerRBTree_begin(RBTree* this)
{
RBTreeElem* treeElem = container_of(rb_first(&this->treeroot), RBTreeElem, treenode);
struct rb_node* node = rb_first(&this->treeroot);
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
RBTreeIter iter;
PointerRBTreeIter_init(&iter, this, treeElem);
......
......@@ -37,9 +37,9 @@ void* PointerRBTreeIter_next(RBTreeIter* this)
{
struct rb_node* next = rb_next(&this->treeElem->treenode);
this->treeElem = container_of(next, RBTreeElem, treenode);
this->treeElem = next ? container_of(next, RBTreeElem, treenode) : NULL;
return this->treeElem ? this->treeElem->value : NULL;
return this->treeElem;
}
void* PointerRBTreeIter_key(RBTreeIter* this)
......
......@@ -13,7 +13,8 @@ StrCpyMapIter StrCpyMap_find(StrCpyMap* this, const char* searchKey)
StrCpyMapIter StrCpyMap_begin(StrCpyMap* this)
{
RBTreeElem* treeElem = container_of(rb_first(&this->rbTree.treeroot), RBTreeElem, treenode);
struct rb_node* node = rb_first(&this->rbTree.treeroot);
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
StrCpyMapIter iter;
StrCpyMapIter_init(&iter, this, treeElem);
......
......@@ -15,7 +15,8 @@ TargetNodeMapIter TargetNodeMap_find(TargetNodeMap* this, const uint16_t searchK
TargetNodeMapIter TargetNodeMap_begin(TargetNodeMap* this)
{
RBTreeElem* treeElem = container_of(rb_first(&this->rbTree.treeroot), RBTreeElem, treenode);
struct rb_node* node = rb_first(&this->rbTree.treeroot);
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
TargetNodeMapIter iter;
TargetNodeMapIter_init(&iter, this, treeElem);
......
......@@ -15,7 +15,8 @@ TargetStateInfoMapIter TargetStateInfoMap_find(TargetStateInfoMap* this,
TargetStateInfoMapIter TargetStateInfoMap_begin(TargetStateInfoMap* this)
{
RBTreeElem* treeElem = container_of(rb_first(&this->rbTree.treeroot), RBTreeElem, treenode);
struct rb_node* node = rb_first(&this->rbTree.treeroot);
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
TargetStateInfoMapIter iter;
TargetStateInfoMapIter_init(&iter, this, treeElem);
......
......@@ -15,7 +15,8 @@ UInt16MapIter UInt16Map_find(UInt16Map* this, const uint16_t searchKey)
UInt16MapIter UInt16Map_begin(UInt16Map* this)
{
RBTreeElem* treeElem = container_of(rb_first(&this->rbTree.treeroot), RBTreeElem, treenode);
struct rb_node* node = rb_first(&this->rbTree.treeroot);
RBTreeElem* treeElem = node ? container_of(node, RBTreeElem, treenode) : NULL;
UInt16MapIter iter;
UInt16MapIter_init(&iter, this, treeElem);
......
......@@ -1919,6 +1919,17 @@ int FhgfsOps_rename(struct inode* inodeDirFrom, struct dentry* dentryFrom,
LOG_DEBUG_FORMATTED(log, Log_DEBUG, logContext, "remoting complete. result: %d", (int)renameRes);
if (unlikely(retVal == -EBUSY && app->cfg->sysRenameEbusyAsXdev))
{
const EntryInfo* fromEntryInfo = FhgfsInode_getEntryInfo(fhgfsFromEntryInode);
Logger_logFormatted(log, Log_NOTICE, logContext, "Rewriting EBUSY to EXDEV: "
"%s fromDirID: %s oldName: %s toDirID: %s newName: %s EntryID: %s",
FhgfsOpsErr_toErrString(renameRes),
fromDirInfo->entryID, oldName, toDirInfo->entryID, newName, fromEntryInfo->entryID);
retVal = -EXDEV;
}
// clean-up
return retVal;
......
......@@ -69,6 +69,7 @@ const char* const PROCFSHELPER_CONFIGKEYS[] =
"sysSessionCheckOnClose",
"sysXAttrsEnabled",
"quotaEnabled",
"sysRenameEbusyAsXdev",
#ifdef LOG_DEBUG_MESSAGES
"tunePageCacheValidityMS", // currently not public
......@@ -141,6 +142,7 @@ int ProcFsHelper_readV2_config(struct seq_file* file, App* app)
seq_printf(file, "sysXAttrsEnabled = %d\n", (int)Config_getSysXAttrsEnabled(cfg) );
seq_printf(file, "sysSessionCheckOnClose = %d\n", (int)Config_getSysSessionCheckOnClose(cfg) );
seq_printf(file, "quotaEnabled = %d\n", (int)Config_getQuotaEnabled(cfg) );
seq_printf(file, "sysRenameEbusyAsXdev = %u\n", (unsigned) cfg->sysRenameEbusyAsXdev);
#ifdef LOG_DEBUG_MESSAGES
......@@ -351,6 +353,9 @@ int ProcFsHelper_read_config(char* buf, char** start, off_t offset, int size, in
if(!strcmp(currentKey, "sysXAttrsEnabled") )
count = scnprintf(buf, size, "%s = %d\n", currentKey, Config_getSysXAttrsEnabled(cfg) );
else
if (!strcmp(currentKey, "sysRenameEbusyAsXdev"))
count = scnprintf(buf, size, "%s = %u\n", currentKey, (unsigned) cfg->sysRenameEbusyAsXdev);
else
if(!strcmp(currentKey, "quotaEnabled") )
count = scnprintf(buf, size, "%s = %u\n", currentKey,
Config_getQuotaEnabled(cfg) );
......
......@@ -206,6 +206,7 @@ void Config::applyConfigMap(bool enableException, bool addDashes) throw (Invalid
IGNORE_CONFIG_CLIENT_VALUE("tuneDirSubentryCacheValidityMS")
IGNORE_CONFIG_CLIENT_VALUE("tuneFileSubentryCacheValidityMS")
IGNORE_CONFIG_CLIENT_VALUE("tuneCoherentBuffers")
IGNORE_CONFIG_CLIENT_VALUE("sysRenameEbusyAsXdev")
if(testConfigMapKeyMatch(iter, "runDaemonized", addDashes) )
runDaemonized = StringTk::strToBool(iter->second);
else
......
......@@ -118,8 +118,7 @@ class ModificationEventFlusher: public PThread
*/
bool disableLoggingLocally(bool fromWorker)
{
if ( this->loggingEnabled.read() != 0 )
this->loggingEnabled.setZero();
loggingEnabled.setZero();
stallAllWorkers(fromWorker, true);
......
......@@ -13,7 +13,7 @@ bool SessionFile::operator==(const SessionFile& other) const
bool SessionFile::relinkInode(MetaStore& store)
{
auto openRes = store.openFile(&entryInfo, accessFlags, inode);
auto openRes = store.openFile(&entryInfo, accessFlags, inode, true);
if (openRes == FhgfsOpsErr_SUCCESS)
return true;
......
......@@ -375,10 +375,27 @@ bool MetaStore::moveReferenceToMetaFileStoreUnlocked(const std::string& parentEn
* @param accessFlags OPENFILE_ACCESS_... flags
*/
FhgfsOpsErr MetaStore::openFile(EntryInfo* entryInfo, unsigned accessFlags,
MetaFileHandle& outInode)
MetaFileHandle& outInode, bool checkDisposalFirst)
{
UniqueRWLock lock(rwlock, SafeRWLock_READ);
// session restore must load disposed files with disposal as parent entry id - if the file is
// disposed any other parent id will also work, but will make that parent id unremovable for
// as long as the file is opened.
if (unlikely(checkDisposalFirst))
{
auto eiDisposal = *entryInfo;
eiDisposal.setParentEntryID(META_DISPOSALDIR_ID_STR);
FileInode* inode;
auto openRes = this->fileStore.openFile(&eiDisposal, accessFlags, inode, true);
if (inode)
{
outInode = {inode, nullptr};
return openRes;
}
}
/* check the MetaStore fileStore map here, but most likely the file will not be in this map,
* but is either in the per-directory-map or has to be loaded from disk */
if (this->fileStore.isInStore(entryInfo->getEntryID()))
......
......@@ -38,7 +38,8 @@ class MetaStore
bool referenceInode(const std::string& entryID, bool isBuddyMirrored,
MetaFileHandle& outFileInode, DirInode*& outDirInode);
FhgfsOpsErr openFile(EntryInfo* entryInfo, unsigned accessFlags, MetaFileHandle& outFile);
FhgfsOpsErr openFile(EntryInfo* entryInfo, unsigned accessFlags, MetaFileHandle& outFile,
bool checkDisposalFirst = false);
void closeFile(EntryInfo* entryInfo, MetaFileHandle file, unsigned accessFlags,
unsigned* outNumHardlinks, unsigned* outNumRefs);
......
......@@ -695,6 +695,7 @@ void App::readTargetStates(const bool firstRun, StringMap& formatProperties,
{
// The first run in this mgmtd directory - just set the flag.
formatProperties[propertiesKey] = "1";
stateStore->saveStatesToFile();
return;
}
......@@ -711,6 +712,7 @@ void App::readTargetStates(const bool firstRun, StringMap& formatProperties,
::unlink(stateStore->getResyncSetStorePath().c_str());
}
stateStore->saveStatesToFile();
formatProperties[propertiesKey] = "1";
}
......
......@@ -343,7 +343,7 @@ bool MgmtdTargetStateStore::resolvePrimaryResync()
mbgm->switchover(*groupIDIt);
}
return false;
return !groupsToSwitch.empty();
}
......@@ -552,8 +552,8 @@ bool MgmtdTargetStateStore::setTargetsGood(const UInt16Vector& ids)
*node, &msg, NETMSGTYPE_SetTargetConsistencyStatesResp, &respBuf, &respMsg);
if (!commRes)
{
LOG_TOP(STATESYNC, ERR, "Unable to set primar " + nodeTypeStr(false) +
" to target state good.", id);
LOG_TOP(STATESYNC, ERR, "Unable to set primary " + nodeTypeStr(false) +
" to state good.", id);
continue;
}
......
......@@ -273,6 +273,7 @@ void Config::applyConfigMap(bool enableException, bool addDashes) throw(InvalidC
IGNORE_CONFIG_CLIENT_VALUE("sysACLsEnabled")
IGNORE_CONFIG_CLIENT_VALUE("quotaEnabled")
IGNORE_CONFIG_CLIENT_VALUE("sysRenameEbusyAsXdev")
if(testConfigMapKeyMatch(iter, "runDaemonized", addDashes) )
runDaemonized = StringTk::strToBool(iter->second);
else
......
......@@ -554,7 +554,7 @@ bool ModeGetQuotaInfo::printQuotaForRange(QuotaDataMap* usedQuota, QuotaDataMap*
std::string& defaultSizeLimitValue, std::string& defaultInodeLimit,
QuotaInodeSupport quotaInodeSupport)
{
bool allValid = false;
bool allValid = true;
for(unsigned id = this->cfg.cfgIDRangeStart; id <= this->cfg.cfgIDRangeEnd; id++)
{
......
......@@ -241,6 +241,10 @@ void ModeSetPattern::printHelp()
std::cout << " limitations of enterprise features." << std::endl;
std::cout << " --force Allow buddy mirror pattern to be set, even if no" << std::endl;
std::cout << " groups have been defined." << std::endl;
std::cout << " --unmounted If this is specified then the given path is" << std::endl;
std::cout << " relative to the root directory of a possibly" << std::endl;
std::cout << " unmounted BeeGFS. (Symlinks will not be resolved" << std::endl;
std::cout << " in this case.)" << std::endl;
std::cout << std::endl;
std::cout << "USAGE:" << std::endl;
std::cout << " This mode sets a new striping configuration for a certain directory. The new" << std::endl;
......
......@@ -71,7 +71,7 @@ int ModeMigrate::doExecute()
if (this->rootFD < 0)
{
std::cerr << "Failed to open search path: " << strerror(errno) << std::endl;
return retVal;
return APPCODE_RUNTIME_ERROR;
}
}
......@@ -511,7 +511,7 @@ void ModeMigrate::printHelpFind()
std::cout << " --nodeid=<nodeID> Find files on targets attached to this nodeID." << std::endl;
std::cout << " --nodetype=<nodetype> Find files on the given nodetype (meta, storage)." << std::endl;
std::cout << " (Default: storage)" << std::endl;
std::cout << " --nomirrors Do not include mirror targets in search." << std::endl;
std::cout << " --nomirrors Do not include buddy mirrored files in search." << std::endl;
std::cout << std::endl;
std::cout << " Note: Either targetID or nodeID must be specified." << std::endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment