aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2013-11-14 07:25:18 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-12-06 13:06:31 -0500
commit89f842435c630f8426f414e6030bc2ffea0d6f81 (patch)
tree5f377121615ac15042edbfb1337d569446863b21
parent4b9a445e3eeb8bd9278b1ae51c1b3a651e370cd6 (diff)
sunrpc: replace sunrpc_net->gssd_running flag with a more reliable check
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. There's also no need to attempt an upcall that we know will fail, so just return -EACCES if gssd isn't running. Finally, fix the warn_gss() message not to claim that that the upcall timed out since we don't necesarily perform one now when gssd isn't running, and remove the extraneous newline from the message. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c17
-rw-r--r--net/sunrpc/netns.h2
-rw-r--r--net/sunrpc/rpc_pipe.c14
4 files changed, 19 insertions, 16 deletions
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 85f13424647c..7f490bef9e99 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -131,5 +131,7 @@ extern int rpc_unlink(struct dentry *);
131extern int register_rpc_pipefs(void); 131extern int register_rpc_pipefs(void);
132extern void unregister_rpc_pipefs(void); 132extern void unregister_rpc_pipefs(void);
133 133
134extern bool gssd_running(struct net *net);
135
134#endif 136#endif
135#endif 137#endif
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 42fdfc634e56..0a2aee060f9f 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -536,8 +536,7 @@ static void warn_gssd(void)
536 unsigned long now = jiffies; 536 unsigned long now = jiffies;
537 537
538 if (time_after(now, ratelimit)) { 538 if (time_after(now, ratelimit)) {
539 printk(KERN_WARNING "RPC: AUTH_GSS upcall timed out.\n" 539 pr_warn("RPC: AUTH_GSS upcall failed. Please check user daemon is running.\n");
540 "Please check user daemon is running.\n");
541 ratelimit = now + 15*HZ; 540 ratelimit = now + 15*HZ;
542 } 541 }
543} 542}
@@ -600,7 +599,6 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)
600 struct rpc_pipe *pipe; 599 struct rpc_pipe *pipe;
601 struct rpc_cred *cred = &gss_cred->gc_base; 600 struct rpc_cred *cred = &gss_cred->gc_base;
602 struct gss_upcall_msg *gss_msg; 601 struct gss_upcall_msg *gss_msg;
603 unsigned long timeout;
604 DEFINE_WAIT(wait); 602 DEFINE_WAIT(wait);
605 int err; 603 int err;
606 604
@@ -608,17 +606,16 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)
608 __func__, from_kuid(&init_user_ns, cred->cr_uid)); 606 __func__, from_kuid(&init_user_ns, cred->cr_uid));
609retry: 607retry:
610 err = 0; 608 err = 0;
611 /* Default timeout is 15s unless we know that gssd is not running */ 609 /* if gssd is down, just skip upcalling altogether */
612 timeout = 15 * HZ; 610 if (!gssd_running(net)) {
613 if (!sn->gssd_running) 611 warn_gssd();
614 timeout = HZ >> 2; 612 return -EACCES;
613 }
615 gss_msg = gss_setup_upcall(gss_auth, cred); 614 gss_msg = gss_setup_upcall(gss_auth, cred);
616 if (PTR_ERR(gss_msg) == -EAGAIN) { 615 if (PTR_ERR(gss_msg) == -EAGAIN) {
617 err = wait_event_interruptible_timeout(pipe_version_waitqueue, 616 err = wait_event_interruptible_timeout(pipe_version_waitqueue,
618 sn->pipe_version >= 0, timeout); 617 sn->pipe_version >= 0, 15 * HZ);
619 if (sn->pipe_version < 0) { 618 if (sn->pipe_version < 0) {
620 if (err == 0)
621 sn->gssd_running = 0;
622 warn_gssd(); 619 warn_gssd();
623 err = -EACCES; 620 err = -EACCES;
624 } 621 }
diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h
index 8a8e841d1547..94e506f9d72b 100644
--- a/net/sunrpc/netns.h
+++ b/net/sunrpc/netns.h
@@ -33,8 +33,6 @@ struct sunrpc_net {
33 int pipe_version; 33 int pipe_version;
34 atomic_t pipe_users; 34 atomic_t pipe_users;
35 struct proc_dir_entry *use_gssp_proc; 35 struct proc_dir_entry *use_gssp_proc;
36
37 unsigned int gssd_running;
38}; 36};
39 37
40extern int sunrpc_net_id; 38extern int sunrpc_net_id;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index c23458b464c4..5cd7ad1225a3 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -216,14 +216,11 @@ rpc_destroy_inode(struct inode *inode)
216static int 216static int
217rpc_pipe_open(struct inode *inode, struct file *filp) 217rpc_pipe_open(struct inode *inode, struct file *filp)
218{ 218{
219 struct net *net = inode->i_sb->s_fs_info;
220 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
221 struct rpc_pipe *pipe; 219 struct rpc_pipe *pipe;
222 int first_open; 220 int first_open;
223 int res = -ENXIO; 221 int res = -ENXIO;
224 222
225 mutex_lock(&inode->i_mutex); 223 mutex_lock(&inode->i_mutex);
226 sn->gssd_running = 1;
227 pipe = RPC_I(inode)->pipe; 224 pipe = RPC_I(inode)->pipe;
228 if (pipe == NULL) 225 if (pipe == NULL)
229 goto out; 226 goto out;
@@ -1222,7 +1219,6 @@ int rpc_pipefs_init_net(struct net *net)
1222 return PTR_ERR(sn->gssd_dummy); 1219 return PTR_ERR(sn->gssd_dummy);
1223 1220
1224 mutex_init(&sn->pipefs_sb_lock); 1221 mutex_init(&sn->pipefs_sb_lock);
1225 sn->gssd_running = 1;
1226 sn->pipe_version = -1; 1222 sn->pipe_version = -1;
1227 return 0; 1223 return 0;
1228} 1224}
@@ -1376,6 +1372,16 @@ err_depopulate:
1376 return err; 1372 return err;
1377} 1373}
1378 1374
1375bool
1376gssd_running(struct net *net)
1377{
1378 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
1379 struct rpc_pipe *pipe = sn->gssd_dummy;
1380
1381 return pipe->nreaders || pipe->nwriters;
1382}
1383EXPORT_SYMBOL_GPL(gssd_running);
1384
1379static struct dentry * 1385static struct dentry *
1380rpc_mount(struct file_system_type *fs_type, 1386rpc_mount(struct file_system_type *fs_type,
1381 int flags, const char *dev_name, void *data) 1387 int flags, const char *dev_name, void *data)