From: Jeff Layton <jlayton@redhat.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, steved@redhat.com
Subject: [PATCH 2/2] sunrpc: replace sunrpc_net->gssd_running flag with a better mechanism
Date: Tue, 12 Nov 2013 08:00:25 -0500 [thread overview]
Message-ID: <1384261225-28559-3-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1384261225-28559-1-git-send-email-jlayton@redhat.com>
Now that we have a more reliable method to tell if gssd is running, we
can replace the sn->gssd_running flag with a function that will query to
see if it's up and running.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
include/linux/sunrpc/rpc_pipe_fs.h | 4 ++++
net/sunrpc/auth_gss/auth_gss.c | 13 ++++++++++---
net/sunrpc/netns.h | 2 --
net/sunrpc/rpc_pipe.c | 11 +++++++----
4 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index a353e03..0ba459f 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -5,6 +5,8 @@
#include <linux/workqueue.h>
+struct sunrpc_net;
+
struct rpc_pipe_dir_head {
struct list_head pdh_entries;
struct dentry *pdh_dentry;
@@ -130,5 +132,7 @@ extern int rpc_unlink(struct dentry *);
extern int register_rpc_pipefs(void);
extern void unregister_rpc_pipefs(void);
+extern bool rpc_pipe_is_open(struct rpc_pipe *pipe);
+
#endif
#endif
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 97912b4..d324563 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -592,6 +592,15 @@ out:
return err;
}
+static bool
+gssd_running(struct sunrpc_net *sn)
+{
+ struct inode *inode = sn->gssd_dummy->d_inode;
+ struct rpc_pipe *pipe = RPC_I(inode)->pipe;
+
+ return rpc_pipe_is_open(pipe);
+}
+
static inline int
gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)
{
@@ -610,15 +619,13 @@ retry:
err = 0;
/* Default timeout is 15s unless we know that gssd is not running */
timeout = 15 * HZ;
- if (!sn->gssd_running)
+ if (!gssd_running(sn))
timeout = HZ >> 2;
gss_msg = gss_setup_upcall(gss_auth, cred);
if (PTR_ERR(gss_msg) == -EAGAIN) {
err = wait_event_interruptible_timeout(pipe_version_waitqueue,
sn->pipe_version >= 0, timeout);
if (sn->pipe_version < 0) {
- if (err == 0)
- sn->gssd_running = 0;
warn_gssd();
err = -EACCES;
}
diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h
index 6b82968..39ab6bc 100644
--- a/net/sunrpc/netns.h
+++ b/net/sunrpc/netns.h
@@ -33,8 +33,6 @@ struct sunrpc_net {
int pipe_version;
atomic_t pipe_users;
struct proc_dir_entry *use_gssp_proc;
-
- unsigned int gssd_running;
};
extern int sunrpc_net_id;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 1c54de6..497261f 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -216,14 +216,11 @@ rpc_destroy_inode(struct inode *inode)
static int
rpc_pipe_open(struct inode *inode, struct file *filp)
{
- struct net *net = inode->i_sb->s_fs_info;
- struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
struct rpc_pipe *pipe;
int first_open;
int res = -ENXIO;
mutex_lock(&inode->i_mutex);
- sn->gssd_running = 1;
pipe = RPC_I(inode)->pipe;
if (pipe == NULL)
goto out;
@@ -1227,7 +1224,6 @@ void rpc_pipefs_init_net(struct net *net)
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
mutex_init(&sn->pipefs_sb_lock);
- sn->gssd_running = 1;
sn->pipe_version = -1;
}
@@ -1382,6 +1378,13 @@ err_depopulate:
return err;
}
+bool
+rpc_pipe_is_open(struct rpc_pipe *pipe)
+{
+ return (pipe->nreaders || pipe->nwriters);
+}
+EXPORT_SYMBOL_GPL(rpc_pipe_is_open);
+
static struct dentry *
rpc_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
--
1.8.3.1
next prev parent reply other threads:[~2013-11-12 13:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-12 13:00 [PATCH 0/2] sunrpc: more reliable detection of running gssd Jeff Layton
2013-11-12 13:00 ` [PATCH 1/2] sunrpc: create a new dummy pipe for gssd to hold open Jeff Layton
2013-11-12 17:36 ` Myklebust, Trond
2013-11-12 17:44 ` Jeff Layton
2013-11-12 17:56 ` Myklebust, Trond
2013-11-12 13:00 ` Jeff Layton [this message]
2013-11-12 15:21 ` [PATCH 0/2] sunrpc: more reliable detection of running gssd Steve Dickson
2013-11-12 22:15 ` NeilBrown
2013-11-12 22:37 ` Jeff Layton
2013-11-12 16:02 ` Chuck Lever
2013-11-12 16:08 ` Jeff Layton
2013-11-12 16:15 ` Chuck Lever
2013-11-12 16:56 ` Myklebust, Trond
2013-11-12 17:12 ` Chuck Lever
2013-11-12 17:13 ` Chuck Lever
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=1384261225-28559-3-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
--cc=trond.myklebust@netapp.com \
/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).