From: Jeff Layton <jlayton@redhat.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v3 2/4] nfsd: change heuristic for selecting the client_tracking_ops
Date: Wed, 24 Oct 2012 10:30:16 -0400 [thread overview]
Message-ID: <1351089018-24551-3-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1351089018-24551-1-git-send-email-jlayton@redhat.com>
First, try to use the new usermodehelper upcall. It should succeed or
fail quickly, so there's little cost to doing so.
If it fails, and the legacy tracking dir exists, use that. If it
doesn't exist then fall back to using nfsdcld.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/nfsd/nfs4recover.c | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 46e4081..aa165fd 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -1063,17 +1063,35 @@ nfsd4_client_tracking_init(struct net *net)
int status;
struct path path;
- if (!client_tracking_ops) {
- client_tracking_ops = &nfsd4_cld_tracking_ops;
- status = kern_path(nfs4_recoverydir(), LOOKUP_FOLLOW, &path);
- if (!status) {
- if (S_ISDIR(path.dentry->d_inode->i_mode))
- client_tracking_ops =
- &nfsd4_legacy_tracking_ops;
- path_put(&path);
- }
+ /* just run the init if it the method is already decided */
+ if (client_tracking_ops)
+ goto do_init;
+
+ /*
+ * First, try a UMH upcall. It should succeed or fail quickly, so
+ * there's little harm in trying that first.
+ */
+ client_tracking_ops = &nfsd4_umh_tracking_ops;
+ status = client_tracking_ops->init(net);
+ if (!status)
+ return status;
+
+ /*
+ * See if the recoverydir exists and is a directory. If it is,
+ * then use the legacy ops.
+ */
+ client_tracking_ops = &nfsd4_legacy_tracking_ops;
+ status = kern_path(nfs4_recoverydir(), LOOKUP_FOLLOW, &path);
+ if (!status) {
+ status = S_ISDIR(path.dentry->d_inode->i_mode);
+ path_put(&path);
+ if (status)
+ goto do_init;
}
+ /* Finally, try to use nfsdcld */
+ client_tracking_ops = &nfsd4_cld_tracking_ops;
+do_init:
status = client_tracking_ops->init(net);
if (status) {
printk(KERN_WARNING "NFSD: Unable to initialize client "
--
1.7.11.7
next prev parent reply other threads:[~2012-10-24 14:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-24 14:30 [PATCH v3 0/4] nfsd: add a usermodehelper upcall for client id tracking Jeff Layton
2012-10-24 14:30 ` [PATCH v3 1/4] nfsd: add a usermodehelper upcall for NFSv4 client ID tracking Jeff Layton
2012-10-24 21:03 ` J. Bruce Fields
2012-10-25 11:39 ` Jeff Layton
2012-10-25 15:06 ` J. Bruce Fields
2012-10-25 15:27 ` Jeff Layton
2012-10-25 15:49 ` J. Bruce Fields
2012-10-25 16:59 ` Jeff Layton
2012-10-24 14:30 ` Jeff Layton [this message]
2012-10-24 14:30 ` [PATCH v3 3/4] nfsd: pass info about the legacy recoverydir in environment variables Jeff Layton
2012-10-24 21:31 ` J. Bruce Fields
2012-10-24 14:30 ` [PATCH v3 4/4] nfsd: warn about impending removal of nfsdcld upcall Jeff Layton
2012-10-24 21:32 ` [PATCH v3 0/4] nfsd: add a usermodehelper upcall for client id tracking 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=1351089018-24551-3-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=bfields@fieldses.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).