nfs4: Make request time limit adjustable
This commit is contained in:
@@ -21,6 +21,7 @@ class RootInode;
|
|||||||
struct MountConfiguration {
|
struct MountConfiguration {
|
||||||
bool fHard;
|
bool fHard;
|
||||||
int fRetryLimit;
|
int fRetryLimit;
|
||||||
|
bigtime_t fRequestTimeout;
|
||||||
|
|
||||||
bool fEmulateNamedAttrs;
|
bool fEmulateNamedAttrs;
|
||||||
bool fCacheMetadata;
|
bool fCacheMetadata;
|
||||||
|
|||||||
@@ -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
|
status_t
|
||||||
Server::SendCallAsync(Call* call, Reply** reply, Request** request)
|
Server::SendCallAsync(Call* call, Reply** reply, Request** request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,15 +60,13 @@ public:
|
|||||||
PeerAddress* address);
|
PeerAddress* address);
|
||||||
virtual ~Server();
|
virtual ~Server();
|
||||||
|
|
||||||
status_t SendCall(Call* call, Reply** reply);
|
|
||||||
|
|
||||||
status_t SendCallAsync(Call* call, Reply** reply,
|
status_t SendCallAsync(Call* call, Reply** reply,
|
||||||
Request** request);
|
Request** request);
|
||||||
status_t ResendCallAsync(Call* call,
|
status_t ResendCallAsync(Call* call,
|
||||||
Request* request);
|
Request* request);
|
||||||
|
|
||||||
inline status_t WaitCall(Request* request,
|
inline status_t WaitCall(Request* request,
|
||||||
bigtime_t time = kWaitTime);
|
bigtime_t time);
|
||||||
inline status_t CancelCall(Request* request);
|
inline status_t CancelCall(Request* request);
|
||||||
status_t WakeCall(Request* request);
|
status_t WakeCall(Request* request);
|
||||||
|
|
||||||
@@ -107,7 +105,6 @@ private:
|
|||||||
mutex fRepairLock;
|
mutex fRepairLock;
|
||||||
|
|
||||||
vint32 fXID;
|
vint32 fXID;
|
||||||
static const bigtime_t kWaitTime = 1000000;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ Request::_SendUDP(Cookie* cookie)
|
|||||||
hard = fFileSystem->GetConfiguration().fHard;
|
hard = fFileSystem->GetConfiguration().fHard;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = fServer->WaitCall(rpc);
|
result = fServer->WaitCall(rpc,
|
||||||
|
fFileSystem->GetConfiguration().fRequestTimeout);
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
int attempts = 1;
|
int attempts = 1;
|
||||||
while (result != B_OK && (hard || attempts++ < retryLimit)) {
|
while (result != B_OK && (hard || attempts++ < retryLimit)) {
|
||||||
@@ -56,7 +57,8 @@ Request::_SendUDP(Cookie* cookie)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = fServer->WaitCall(rpc);
|
result = fServer->WaitCall(rpc,
|
||||||
|
fFileSystem->GetConfiguration().fRequestTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
@@ -113,7 +115,8 @@ Request::_SendTCP(Cookie* cookie)
|
|||||||
if (cookie != NULL)
|
if (cookie != NULL)
|
||||||
cookie->RegisterRequest(rpc);
|
cookie->RegisterRequest(rpc);
|
||||||
|
|
||||||
result = fServer->WaitCall(rpc);
|
result = fServer->WaitCall(rpc,
|
||||||
|
fFileSystem->GetConfiguration().fRequestTimeout);
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
if (cookie != NULL)
|
if (cookie != NULL)
|
||||||
cookie->UnregisterRequest(rpc);
|
cookie->UnregisterRequest(rpc);
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ CreateNFS4Server(RPC::Server* serv)
|
|||||||
// Available options:
|
// Available options:
|
||||||
// hard - retry requests until success
|
// hard - retry requests until success
|
||||||
// soft - retry requests no more than retrans times (default)
|
// 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)
|
// retrans=X - retry requests X times (default: 5)
|
||||||
// ac - use metadata cache (default)
|
// ac - use metadata cache (default)
|
||||||
// noac - do not use metadata cache
|
// noac - do not use metadata cache
|
||||||
@@ -101,6 +102,7 @@ ParseArguments(const char* _args, PeerAddress* address, char** _path,
|
|||||||
|
|
||||||
conf->fHard = false;
|
conf->fHard = false;
|
||||||
conf->fRetryLimit = 5;
|
conf->fRetryLimit = 5;
|
||||||
|
conf->fRequestTimeout = sSecToBigTime(60);
|
||||||
conf->fEmulateNamedAttrs = false;
|
conf->fEmulateNamedAttrs = false;
|
||||||
conf->fCacheMetadata = true;
|
conf->fCacheMetadata = true;
|
||||||
|
|
||||||
@@ -116,6 +118,9 @@ ParseArguments(const char* _args, PeerAddress* address, char** _path,
|
|||||||
else if (strncmp(options, "retrans=", 8) == 0) {
|
else if (strncmp(options, "retrans=", 8) == 0) {
|
||||||
options += strlen("retrans=");
|
options += strlen("retrans=");
|
||||||
conf->fRetryLimit = atoi(options);
|
conf->fRetryLimit = atoi(options);
|
||||||
|
} else if (strncmp(options, "timeo=", 6) == 0) {
|
||||||
|
options += strlen("timeo=");
|
||||||
|
conf->fRequestTimeout = atoi(options);
|
||||||
} else if (strcmp(options, "noac") == 0)
|
} else if (strcmp(options, "noac") == 0)
|
||||||
conf->fCacheMetadata = false;
|
conf->fCacheMetadata = false;
|
||||||
else if (strcmp(options, "xattr-emu") == 0)
|
else if (strcmp(options, "xattr-emu") == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user