nfs4: Make request time limit adjustable

This commit is contained in:
Pawel Dziepak 2013-01-04 22:39:40 +01:00
parent dadd844f36
commit ad1a84af93
5 changed files with 17 additions and 34 deletions

View File

@ -19,11 +19,12 @@ class Inode;
class RootInode;
struct MountConfiguration {
bool fHard;
int fRetryLimit;
bool fHard;
int fRetryLimit;
bigtime_t fRequestTimeout;
bool fEmulateNamedAttrs;
bool fCacheMetadata;
bool fEmulateNamedAttrs;
bool fCacheMetadata;
};
class FileSystem : public DoublyLinkedListLinkImpl<FileSystem> {

View File

@ -134,29 +134,6 @@ Server::_StartListening()
}
status_t
Server::SendCall(Call* call, Reply** reply)
{
ASSERT(call != NULL);
ASSERT(reply != NULL);
Request* req;
status_t result = SendCallAsync(call, reply, &req);
if (result != B_OK)
return result;
result = WaitCall(req);
if (result != B_OK) {
CancelCall(req);
delete req;
return result;
}
delete req;
return B_OK;
}
status_t
Server::SendCallAsync(Call* call, Reply** reply, Request** request)
{

View File

@ -60,15 +60,13 @@ public:
PeerAddress* address);
virtual ~Server();
status_t SendCall(Call* call, Reply** reply);
status_t SendCallAsync(Call* call, Reply** reply,
Request** request);
status_t ResendCallAsync(Call* call,
Request* request);
inline status_t WaitCall(Request* request,
bigtime_t time = kWaitTime);
bigtime_t time);
inline status_t CancelCall(Request* request);
status_t WakeCall(Request* request);
@ -107,7 +105,6 @@ private:
mutex fRepairLock;
vint32 fXID;
static const bigtime_t kWaitTime = 1000000;
};

View File

@ -45,7 +45,8 @@ Request::_SendUDP(Cookie* cookie)
hard = fFileSystem->GetConfiguration().fHard;
}
result = fServer->WaitCall(rpc);
result = fServer->WaitCall(rpc,
fFileSystem->GetConfiguration().fRequestTimeout);
if (result != B_OK) {
int attempts = 1;
while (result != B_OK && (hard || attempts++ < retryLimit)) {
@ -56,7 +57,8 @@ Request::_SendUDP(Cookie* cookie)
return result;
}
result = fServer->WaitCall(rpc);
result = fServer->WaitCall(rpc,
fFileSystem->GetConfiguration().fRequestTimeout);
}
if (result != B_OK) {
@ -113,7 +115,8 @@ Request::_SendTCP(Cookie* cookie)
if (cookie != NULL)
cookie->RegisterRequest(rpc);
result = fServer->WaitCall(rpc);
result = fServer->WaitCall(rpc,
fFileSystem->GetConfiguration().fRequestTimeout);
if (result != B_OK) {
if (cookie != NULL)
cookie->UnregisterRequest(rpc);

View File

@ -63,6 +63,7 @@ CreateNFS4Server(RPC::Server* serv)
// Available options:
// hard - retry requests until success
// soft - retry requests no more than retrans times (default)
// timeo=X - request time limit before next retransmission (default: 60s)
// retrans=X - retry requests X times (default: 5)
// ac - use metadata cache (default)
// noac - do not use metadata cache
@ -101,6 +102,7 @@ ParseArguments(const char* _args, PeerAddress* address, char** _path,
conf->fHard = false;
conf->fRetryLimit = 5;
conf->fRequestTimeout = sSecToBigTime(60);
conf->fEmulateNamedAttrs = false;
conf->fCacheMetadata = true;
@ -116,6 +118,9 @@ ParseArguments(const char* _args, PeerAddress* address, char** _path,
else if (strncmp(options, "retrans=", 8) == 0) {
options += strlen("retrans=");
conf->fRetryLimit = atoi(options);
} else if (strncmp(options, "timeo=", 6) == 0) {
options += strlen("timeo=");
conf->fRequestTimeout = atoi(options);
} else if (strcmp(options, "noac") == 0)
conf->fCacheMetadata = false;
else if (strcmp(options, "xattr-emu") == 0)