Skip to contentSkip to conversation

sunrpc: replace sunrpc_net->gssd_running flag with a more reliable check

PATCH Jeff Layton 1 participant 1 message Nov 14, 2013 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 55 lines · On Thu, 14 Nov 2013 10:24:48 +1100 NeilBrown <[email protected]> wrote:
Quoted 26 lines · On Wed, 13 Nov 2013 15:28:12 -0500 Jeff Layton <[email protected]> wrote:

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 in that case.

---
 include/linux/sunrpc/rpc_pipe_fs.h | 14 ++++++++++++++
 net/sunrpc/auth_gss/auth_gss.c     | 10 +++++-----
 net/sunrpc/netns.h                 |  2 --
 net/sunrpc/rpc_pipe.c              | 16 ++++++++++++----
 4 files changed, 31 insertions(+), 11 deletions(-)
include/linux/sunrpc/rpc_pipe_fs.h +3 -0
index 85f1342..438e606 100644
@@ -131,5 +131,19 @@ extern int rpc_unlink(struct dentry *);
 extern int register_rpc_pipefs(void);
 extern void unregister_rpc_pipefs(void);
 
+#if IS_ENABLED(CONFIG_SUNRPC_GSS)
+
+extern bool gssd_running(struct net *net);

include/linux/sunrpc/rpc_pipe_fs.h extern int rpc_unlink(struct dentry *); · line 146

Quoted 10 lines
include/linux/sunrpc/rpc_pipe_fs.h +10 -0
+
+#else /* !CONFIG_SUNRPC_GSS */
+
+static inline bool
+gssd_running(struct net *net)
+{
+	return false;
+}
+
+#endif /* CONFIG_SUNRPC_GSS */

Do we really need IS_ENABLED(CONFIG_SUNRPC_GSS) around this?

The function is tiny, and could even be a "static inline" with very little cost.

Let's just always define it.

But independent of that, the patches look good to me and appear to work.

By the way, the current "only impose the 15 second delay the first time" doesn't really work.
If you:
mount 10.0.2.2:/home /mnt ; umount /mnt

repeatedly then it will take 15-18 seconds every time.

Quoted 7 lines

This is with rpc.gssd not running, but rpc.idmapd running.

As rpc.idmapd opens some rpc-pipe thing, that sets the gssd_running flag. So that is an extra reason to get rid of the flag.

Thanks,
NeilBrown

(adding linux-nfs ml to mailing list since I missed it earlier)

Ahh that is interesting...

My rationale here was that even if someone started gssd on a kernel that didn't have CONFIG_SUNRPC_GSS enabled, that we wouldn't want gssd_running to return true.

But...you're probably right and there's no need for it. I'll plan to fix that (and the commit message error you spotted) and resend tomorrow sometime.

Thanks for the review...

Signature · 1 line
Jeff Layton <[email protected]>