NFSv4.1: pNFS data servers may be temporarily offline
In cases where the pNFS data server is just temporarily out of service, we want to mark it as such, and then try again later. Typically that will be in cases of network connection errors etc. This patch allows us to mark the devices as being "unavailable" for such transient errors, and will make them available for retries after a 2 minute timeout period. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
#define NFS4_DEVICE_ID_HASH_SIZE (1 << NFS4_DEVICE_ID_HASH_BITS)
|
||||
#define NFS4_DEVICE_ID_HASH_MASK (NFS4_DEVICE_ID_HASH_SIZE - 1)
|
||||
|
||||
#define PNFS_DEVICE_RETRY_TIMEOUT (120*HZ)
|
||||
|
||||
static struct hlist_head nfs4_deviceid_cache[NFS4_DEVICE_ID_HASH_SIZE];
|
||||
static DEFINE_SPINLOCK(nfs4_deviceid_lock);
|
||||
|
||||
@@ -218,6 +220,30 @@ nfs4_put_deviceid_node(struct nfs4_deviceid_node *d)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nfs4_put_deviceid_node);
|
||||
|
||||
void
|
||||
nfs4_mark_deviceid_unavailable(struct nfs4_deviceid_node *node)
|
||||
{
|
||||
node->timestamp_unavailable = jiffies;
|
||||
set_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nfs4_mark_deviceid_unavailable);
|
||||
|
||||
bool
|
||||
nfs4_test_deviceid_unavailable(struct nfs4_deviceid_node *node)
|
||||
{
|
||||
if (test_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags)) {
|
||||
unsigned long start, end;
|
||||
|
||||
end = jiffies;
|
||||
start = end - PNFS_DEVICE_RETRY_TIMEOUT;
|
||||
if (time_in_range(node->timestamp_unavailable, start, end))
|
||||
return true;
|
||||
clear_bit(NFS_DEVICEID_UNAVAILABLE, &node->flags);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nfs4_test_deviceid_unavailable);
|
||||
|
||||
static void
|
||||
_deviceid_purge_client(const struct nfs_client *clp, long hash)
|
||||
{
|
||||
@@ -276,3 +302,4 @@ nfs4_deviceid_mark_client_invalid(struct nfs_client *clp)
|
||||
}
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user