Commit 7d3e26a0 authored by Benjamin Coddington's avatar Benjamin Coddington Committed by Trond Myklebust

NFS: Cancel all existing RPC tasks when shutdown

Walk existing RPC tasks and cancel them with -EIO when the client is
shutdown.
Signed-off-by: default avatarBenjamin Coddington <bcodding@redhat.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent d9615d16
...@@ -217,6 +217,17 @@ void nfs_netns_sysfs_destroy(struct nfs_net *netns) ...@@ -217,6 +217,17 @@ void nfs_netns_sysfs_destroy(struct nfs_net *netns)
} }
} }
static bool shutdown_match_client(const struct rpc_task *task, const void *data)
{
return true;
}
static void shutdown_client(struct rpc_clnt *clnt)
{
clnt->cl_shutdown = 1;
rpc_cancel_tasks(clnt, -EIO, shutdown_match_client, NULL);
}
static ssize_t static ssize_t
shutdown_show(struct kobject *kobj, struct kobj_attribute *attr, shutdown_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf) char *buf)
...@@ -247,14 +258,14 @@ shutdown_store(struct kobject *kobj, struct kobj_attribute *attr, ...@@ -247,14 +258,14 @@ shutdown_store(struct kobject *kobj, struct kobj_attribute *attr,
goto out; goto out;
server->flags |= NFS_MOUNT_SHUTDOWN; server->flags |= NFS_MOUNT_SHUTDOWN;
server->client->cl_shutdown = 1; shutdown_client(server->client);
server->nfs_client->cl_rpcclient->cl_shutdown = 1; shutdown_client(server->nfs_client->cl_rpcclient);
if (!IS_ERR(server->client_acl)) if (!IS_ERR(server->client_acl))
server->client_acl->cl_shutdown = 1; shutdown_client(server->client_acl);
if (server->nlm_host) if (server->nlm_host)
server->nlm_host->h_rpcclnt->cl_shutdown = 1; shutdown_client(server->nlm_host->h_rpcclnt);
out: out:
return count; return count;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment