nfs4: Do not ignore idmapper initialization errors
This commit is contained in:
@@ -23,7 +23,7 @@ mutex gIdMapperLock;
|
|||||||
IdMap::IdMap()
|
IdMap::IdMap()
|
||||||
{
|
{
|
||||||
mutex_init(&fLock, NULL);
|
mutex_init(&fLock, NULL);
|
||||||
_Repair();
|
fInitStatus = _Repair();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,30 +16,41 @@
|
|||||||
|
|
||||||
class IdMap {
|
class IdMap {
|
||||||
public:
|
public:
|
||||||
IdMap();
|
IdMap();
|
||||||
~IdMap();
|
~IdMap();
|
||||||
|
|
||||||
uid_t GetUserId(const char* owner);
|
uid_t GetUserId(const char* owner);
|
||||||
gid_t GetGroupId(const char* ownerGroup);
|
gid_t GetGroupId(const char* ownerGroup);
|
||||||
|
|
||||||
char* GetOwner(uid_t user);
|
char* GetOwner(uid_t user);
|
||||||
char* GetOwnerGroup(gid_t group);
|
char* GetOwnerGroup(gid_t group);
|
||||||
|
|
||||||
|
inline status_t InitStatus();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
status_t _Repair();
|
status_t _Repair();
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void* _GetBuffer(T value, int32 code);
|
void* _GetBuffer(T value, int32 code);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T _GetValue(const char* buffer, int32 code);
|
T _GetValue(const char* buffer, int32 code);
|
||||||
|
|
||||||
mutex fLock;
|
status_t fInitStatus;
|
||||||
|
|
||||||
port_id fRequestPort;
|
mutex fLock;
|
||||||
port_id fReplyPort;
|
|
||||||
|
port_id fRequestPort;
|
||||||
|
port_id fReplyPort;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline status_t
|
||||||
|
IdMap::InitStatus()
|
||||||
|
{
|
||||||
|
return fInitStatus;
|
||||||
|
}
|
||||||
|
|
||||||
extern IdMap* gIdMapper;
|
extern IdMap* gIdMapper;
|
||||||
extern mutex gIdMapperLock;
|
extern mutex gIdMapperLock;
|
||||||
|
|
||||||
|
|||||||
@@ -124,10 +124,18 @@ nfs4_mount(fs_volume* volume, const char* device, uint32 flags,
|
|||||||
{
|
{
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
|
/* prepare idmapper server */
|
||||||
MutexLocker locker(gIdMapperLock);
|
MutexLocker locker(gIdMapperLock);
|
||||||
gIdMapper = new(std::nothrow) IdMap;
|
gIdMapper = new(std::nothrow) IdMap;
|
||||||
if (gIdMapper == NULL)
|
if (gIdMapper == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
result = gIdMapper->InitStatus();
|
||||||
|
if (result != B_OK) {
|
||||||
|
delete gIdMapper;
|
||||||
|
gIdMapper = NULL;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
locker.Unlock();
|
locker.Unlock();
|
||||||
|
|
||||||
PeerAddress address;
|
PeerAddress address;
|
||||||
|
|||||||
Reference in New Issue
Block a user