Commit e47d1aec authored by Christian Mohrbacher's avatar Christian Mohrbacher

updated to release 2015.03-r27

parent be809e71
......@@ -492,7 +492,7 @@ int FhgfsOps_set_acl(struct inode* inode, struct posix_acl* acl, int type)
FhgfsOpsErr remotingRes;
char* xAttrName;
int xAttrBufLen;
void* xAttrBuf;
void* xAttrBuf = NULL;
FhgfsInode* fhgfsInode = BEEGFS_INODE(inode);
EntryInfo* entryInfo = FhgfsInode_getEntryInfo(fhgfsInode);
......@@ -508,21 +508,31 @@ int FhgfsOps_set_acl(struct inode* inode, struct posix_acl* acl, int type)
else
return -EOPNOTSUPP;
// prepare extended attribute - determine size needed for buffer.
xAttrBufLen = os_posix_acl_to_xattr(acl, NULL, 0);
if (acl)
{
// prepare extended attribute - determine size needed for buffer.
xAttrBufLen = os_posix_acl_to_xattr(acl, NULL, 0);
if (xAttrBufLen < 0)
return xAttrBufLen;
if (xAttrBufLen < 0)
return xAttrBufLen;
xAttrBuf = os_kmalloc(xAttrBufLen);
if (!xAttrBuf)
return -ENOMEM;
xAttrBuf = os_kmalloc(xAttrBufLen);
if (!xAttrBuf)
return -ENOMEM;
res = os_posix_acl_to_xattr(acl, xAttrBuf, xAttrBufLen);
if (res != xAttrBufLen)
goto cleanup;
res = os_posix_acl_to_xattr(acl, xAttrBuf, xAttrBufLen);
if (res != xAttrBufLen)
goto cleanup;
remotingRes = FhgfsOpsRemoting_setXAttr(app, entryInfo, xAttrName, xAttrBuf, xAttrBufLen, 0);
}
else
{
remotingRes = FhgfsOpsRemoting_removeXAttr(app, entryInfo, xAttrName);
if (remotingRes == FhgfsOpsErr_NODATA)
remotingRes = FhgfsOpsErr_SUCCESS;
}
remotingRes = FhgfsOpsRemoting_setXAttr(app, entryInfo, xAttrName, xAttrBuf, xAttrBufLen, 0);
if (remotingRes != FhgfsOpsErr_SUCCESS)
res = FhgfsOpsErr_toSysErr(remotingRes);
else
......
......@@ -128,7 +128,8 @@ static inline struct dentry *file_dentry(const struct file *file)
}
#endif
#ifndef KERNEL_HAS_FILE_INODE
/* mlnx ofeds backport this too and #define file_inode backport_file_inode */
#if !defined(KERNEL_HAS_FILE_INODE) && !defined(file_inode)
struct inode *file_inode(struct file *f)
{
return file_dentry(f)->d_inode;
......
......@@ -24,7 +24,7 @@ class Condition
{
int condRes = pthread_cond_destroy(&condition);
if(unlikely(condRes) )
throw MutexException(System::getErrString(condRes) );
std::terminate();
}
static bool initStaticCondAttr();
......
......@@ -14,16 +14,13 @@ class Mutex
{
pthread_mutex_init(&mutex, NULL);
}
/**
* @throw MutexException
*/
~Mutex()
{
int pthreadRes = pthread_mutex_destroy(&mutex);
if(unlikely(pthreadRes) )
throw MutexException(System::getErrString(pthreadRes));
// may return:
// * [EBUSY] never returned by glibc, little useful info without a lockdep tool
// * [EINVAL] never happens (mutex is properly initialized)
pthread_mutex_destroy(&mutex);
}
/**
......@@ -37,29 +34,21 @@ class Mutex
throw MutexException(System::getErrString(pthreadRes));
}
/**
* @throw MutexException
*/
bool tryLock()
{
int pthreadRes = pthread_mutex_trylock(&mutex);
if(!pthreadRes)
return true;
if(pthreadRes == EBUSY)
return false;
throw MutexException(System::getErrString(pthreadRes));
// may return:
// * [EINVAL] never happens (mutex is properly initialized)
// * [EBUSY] not an error
// * [EAGAIN] never happens (this mutex is not recursive)
return pthread_mutex_trylock(&mutex) == 0;
}
/**
* @throw MutexException
*/
void unlock()
{
int pthreadRes = pthread_mutex_unlock(&mutex);
if(unlikely(pthreadRes) )
throw MutexException(System::getErrString(pthreadRes));
// may return:
// * [EINVAL] never happens (mutex is properly initialized)
// * [EPERM] never returned by glibc, little useful info without a lockdep tool
pthread_mutex_unlock(&mutex);
}
private:
......
......@@ -63,15 +63,12 @@ class RWLock
lockType = RWLockType_UNSET;
}
/**
* @throw RWLockException
*/
~RWLock()
{
int pthreadRes = pthread_rwlock_destroy(&rwlock);
if(unlikely(pthreadRes) )
throw RWLockException(System::getErrString(pthreadRes) );
// may return
// * [EBUSY] never returned by glibc, little useful info without a lockdep tool
// * [EINVAL] never happens (mutex is properly initialized)
pthread_rwlock_destroy(&rwlock);
}
/**
......@@ -176,59 +173,39 @@ class RWLock
return 0;
}
/**
* @throw RWLockException
*/
bool tryWriteLock()
{
int pthreadRes = pthread_rwlock_trywrlock(&rwlock);
if(!pthreadRes)
{
lockType = RWLockType_WRITE;
return true;
}
if(pthreadRes == EBUSY)
// may return
// * [EINVAL] never happens (rwlock is properly initialized)
// * [EBUSY] not an error
if (pthread_rwlock_trywrlock(&rwlock) != 0)
return false;
throw RWLockException(System::getErrString(pthreadRes) );
lockType = RWLockType_WRITE;
return true;
}
/**
* @throw RWLockException
*/
bool tryReadLock()
{
int pthreadRes = pthread_rwlock_tryrdlock(&rwlock);
if(!pthreadRes)
{
lockType = RWLockType_READ;
return true;
}
if(pthreadRes == EBUSY)
// may return
// * [EINVAL] never happens (rwlock is properly initialized)
// * [EBUSY] not an error
// * [EAGAIN] not an error
if (pthread_rwlock_tryrdlock(&rwlock) != 0)
return false;
throw RWLockException(System::getErrString(pthreadRes) );
lockType = RWLockType_READ;
return true;
}
/**
* @throw RWLockException
*/
void unlock()
{
RWLockLockType oldLockType = lockType; // store the old value
lockType = RWLockType_UNSET;
int pthreadRes = pthread_rwlock_unlock(&rwlock);
if(unlikely(pthreadRes) )
{
lockType = oldLockType;
throw RWLockException(System::getErrString(pthreadRes) );
}
// may return:
// * [EINVAL] never happens (rwlock is properly initialized)
// * [EPERM] never returned by glibc, little useful info without a lockdep tool
pthread_rwlock_unlock(&rwlock);
}
......
......@@ -114,7 +114,8 @@ int BuddyResyncerGatherSlave::handleDiscoveredEntry(const char* path,
if ( relPathStr.empty() )
return FTW_CONTINUE;
bool buddyCommIsOverride;
bool buddyCommIsOverride = false; // mute gcc. this value will not be initialized only if the
// target does not exist.
int64_t lastBuddyCommTimeSecs =
storageTargets->readLastBuddyCommTimestamp(thisStatic->getTargetID(), &buddyCommIsOverride);
int64_t lastBuddyCommSafetyThresholdSecs = cfg->getSysResyncSafetyThresholdMins()*60;
......
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