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