Commit 758201e2 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Fix the minor version callback channel startup

The current spaghetti code confuses some versions of gcc (and just
looks ugly as hell)! Clean up...
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 9f62387d
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/sunrpc/svc.h> #include <linux/sunrpc/svc.h>
#include <linux/sunrpc/svcsock.h> #include <linux/sunrpc/svcsock.h>
#include <linux/nfs_fs.h> #include <linux/nfs_fs.h>
#include <linux/errno.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/freezer.h> #include <linux/freezer.h>
#include <linux/kthread.h> #include <linux/kthread.h>
...@@ -177,15 +178,11 @@ nfs41_callback_up(struct svc_serv *serv) ...@@ -177,15 +178,11 @@ nfs41_callback_up(struct svc_serv *serv)
return rqstp; return rqstp;
} }
static inline int nfs_minorversion_callback_svc_setup(u32 minorversion, static void nfs_minorversion_callback_svc_setup(struct svc_serv *serv,
struct svc_serv *serv,
struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp)) struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp))
{ {
if (minorversion) { *rqstpp = nfs41_callback_up(serv);
*rqstpp = nfs41_callback_up(serv); *callback_svc = nfs41_callback_svc;
*callback_svc = nfs41_callback_svc;
}
return minorversion;
} }
static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt, static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
...@@ -204,11 +201,11 @@ static int nfs41_callback_up_net(struct svc_serv *serv, struct net *net) ...@@ -204,11 +201,11 @@ static int nfs41_callback_up_net(struct svc_serv *serv, struct net *net)
return 0; return 0;
} }
static inline int nfs_minorversion_callback_svc_setup(u32 minorversion, static void nfs_minorversion_callback_svc_setup(struct svc_serv *serv,
struct svc_serv *serv,
struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp)) struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp))
{ {
return 0; *rqstpp = ERR_PTR(-ENOTSUPP);
*callback_svc = ERR_PTR(-ENOTSUPP);
} }
static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt, static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
...@@ -225,19 +222,21 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt, ...@@ -225,19 +222,21 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion]; struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion];
char svc_name[12]; char svc_name[12];
int ret; int ret;
int minorversion_setup;
nfs_callback_bc_serv(minorversion, xprt, serv); nfs_callback_bc_serv(minorversion, xprt, serv);
if (cb_info->task) if (cb_info->task)
return 0; return 0;
minorversion_setup = nfs_minorversion_callback_svc_setup(minorversion, switch (minorversion) {
serv, &rqstp, &callback_svc); case 0:
if (!minorversion_setup) {
/* v4.0 callback setup */ /* v4.0 callback setup */
rqstp = nfs4_callback_up(serv); rqstp = nfs4_callback_up(serv);
callback_svc = nfs4_callback_svc; callback_svc = nfs4_callback_svc;
break;
default:
nfs_minorversion_callback_svc_setup(serv,
&rqstp, &callback_svc);
} }
if (IS_ERR(rqstp)) if (IS_ERR(rqstp))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment