From: "J. Bruce Fields" <bfields@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: "J. Bruce Fields" <bfields@citi.umich.edu>
Subject: [PATCH 05/16] nfsd4: use generic callback code in null case
Date: Thu, 30 Sep 2010 12:19:02 -0400 [thread overview]
Message-ID: <1285863553-8945-6-git-send-email-bfields@redhat.com> (raw)
In-Reply-To: <1285863553-8945-1-git-send-email-bfields@redhat.com>
From: J. Bruce Fields <bfields@citi.umich.edu>
This will eventually allow us, for example, to kick off null callback
from contexts where we can't sleep.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
---
fs/nfsd/nfs4callback.c | 33 ++++++++++++++++++---------------
fs/nfsd/nfs4state.c | 1 +
fs/nfsd/state.h | 1 +
3 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 2289ad5..3b06212 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -518,7 +518,7 @@ static void warn_no_callback_path(struct nfs4_client *clp, int reason)
static void nfsd4_cb_probe_done(struct rpc_task *task, void *calldata)
{
- struct nfs4_client *clp = calldata;
+ struct nfs4_client *clp = container_of(calldata, struct nfs4_client, cl_cb_null);
if (task->tk_status)
warn_no_callback_path(clp, task->tk_status);
@@ -527,6 +527,8 @@ static void nfsd4_cb_probe_done(struct rpc_task *task, void *calldata)
}
static const struct rpc_call_ops nfsd4_cb_probe_ops = {
+ /* XXX: release method to ensure we set the cb channel down if
+ * necessary on early failure? */
.rpc_call_done = nfsd4_cb_probe_done,
};
@@ -542,21 +544,23 @@ int set_callback_cred(void)
return 0;
}
+static struct workqueue_struct *callback_wq;
void do_probe_callback(struct nfs4_client *clp)
{
- struct rpc_message msg = {
- .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL],
- .rpc_argp = clp,
- .rpc_cred = callback_cred
- };
- int status;
+ struct nfsd4_callback *cb = &clp->cl_cb_null;
- status = rpc_call_async(clp->cl_cb_client, &msg,
- RPC_TASK_SOFT | RPC_TASK_SOFTCONN,
- &nfsd4_cb_probe_ops, (void *)clp);
- if (status)
- warn_no_callback_path(clp, status);
+ cb->cb_args.args_op = NULL;
+ cb->cb_args.args_clp = clp;
+
+ cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL];
+ cb->cb_msg.rpc_argp = NULL;
+ cb->cb_msg.rpc_resp = NULL;
+ cb->cb_msg.rpc_cred = callback_cred;
+
+ cb->cb_ops = &nfsd4_cb_probe_ops;
+
+ queue_work(callback_wq, &cb->cb_work);
}
/*
@@ -712,8 +716,6 @@ static const struct rpc_call_ops nfsd4_cb_recall_ops = {
.rpc_release = nfsd4_cb_recall_release,
};
-static struct workqueue_struct *callback_wq;
-
int nfsd4_create_callback_queue(void)
{
callback_wq = create_singlethread_workqueue("nfsd4_callbacks");
@@ -759,7 +761,8 @@ void nfsd4_do_callback_rpc(struct work_struct *w)
nfsd4_release_cb(cb);
return; /* Client is shutting down; give up. */
}
- rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT, cb->cb_ops, cb);
+ rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT | RPC_TASK_SOFTCONN,
+ cb->cb_ops, cb);
}
void nfsd4_cb_recall(struct nfs4_delegation *dp)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index d347180..2f464fb 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -978,6 +978,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name, char *recdir,
INIT_LIST_HEAD(&clp->cl_delegations);
INIT_LIST_HEAD(&clp->cl_sessions);
INIT_LIST_HEAD(&clp->cl_lru);
+ INIT_WORK(&clp->cl_cb_null.cb_work, nfsd4_do_callback_rpc);
clp->cl_time = get_seconds();
clear_bit(0, &clp->cl_cb_slot_busy);
rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table");
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 6e59214..19732d5 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -223,6 +223,7 @@ struct nfs4_client {
struct nfs4_cb_conn cl_cb_conn;
struct rpc_clnt *cl_cb_client;
atomic_t cl_cb_set;
+ struct nfsd4_callback cl_cb_null;
/* for nfs41 */
struct list_head cl_sessions;
--
1.7.0.4
next prev parent reply other threads:[~2010-09-30 16:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-30 16:18 4.1 patches J. Bruce Fields
2010-09-30 16:18 ` [PATCH 01/16] nfsd4: minor variable renaming (cb -> conn) J. Bruce Fields
2010-09-30 16:18 ` [PATCH 02/16] nfsd4: combine nfs4_rpc_args and nfsd4_cb_sequence J. Bruce Fields
2010-09-30 16:19 ` [PATCH 03/16] nfsd4: rename nfs4_rpc_args->nfsd4_cb_args J. Bruce Fields
2010-09-30 16:19 ` [PATCH 04/16] nfsd4: generic callback code J. Bruce Fields
2010-09-30 16:19 ` J. Bruce Fields [this message]
2010-09-30 16:19 ` [PATCH 06/16] nfsd4: remove separate cb_args struct J. Bruce Fields
2010-09-30 16:19 ` [PATCH 07/16] nfsd4: Move callback setup to callback queue J. Bruce Fields
2010-09-30 16:19 ` [PATCH 08/16] nfsd4: fix alloc_init_session BUILD_BUG_ON() J. Bruce Fields
2010-09-30 16:19 ` [PATCH 09/16] nfsd4: fix alloc_init_session return type J. Bruce Fields
2010-09-30 16:19 ` [PATCH 10/16] nfsd4: clean up session allocation J. Bruce Fields
2010-09-30 16:19 ` [PATCH 11/16] nfsd4: keep per-session list of connections J. Bruce Fields
2010-09-30 21:21 ` Benny Halevy
2010-09-30 21:38 ` J. Bruce Fields
2010-09-30 16:19 ` [PATCH 12/16] nfsd: provide callbacks on svc_xprt deletion J. Bruce Fields
2010-09-30 16:19 ` [PATCH 13/16] nfsd4: use callbacks on svc_xprt_deletion J. Bruce Fields
2010-09-30 16:19 ` [PATCH 14/16] nfsd4: refactor connection allocation J. Bruce Fields
2010-09-30 16:19 ` [PATCH 15/16] nfsd4: add new connections to session J. Bruce Fields
2010-09-30 21:33 ` Benny Halevy
2010-09-30 21:57 ` J. Bruce Fields
2010-09-30 16:19 ` [PATCH 16/16] nfsd4: enforce DESTROY_SESSION connection requirement J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1285863553-8945-6-git-send-email-bfields@redhat.com \
--to=bfields@redhat.com \
--cc=bfields@citi.umich.edu \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.