aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-01 19:33:18 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-01 19:58:39 -0400
commit758201e2c94b7d26ea0ac64e55cab1d53742780a (patch)
tree0298ab5bf31e8def1ea10285217ab8e311b8aab4 /fs/nfs
parent9f62387d6e26532bcbfb15606956074192ee526a (diff)
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: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/callback.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 8ed0bc8cffb6..2245bef50f37 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -12,6 +12,7 @@
12#include <linux/sunrpc/svc.h> 12#include <linux/sunrpc/svc.h>
13#include <linux/sunrpc/svcsock.h> 13#include <linux/sunrpc/svcsock.h>
14#include <linux/nfs_fs.h> 14#include <linux/nfs_fs.h>
15#include <linux/errno.h>
15#include <linux/mutex.h> 16#include <linux/mutex.h>
16#include <linux/freezer.h> 17#include <linux/freezer.h>
17#include <linux/kthread.h> 18#include <linux/kthread.h>
@@ -177,15 +178,11 @@ nfs41_callback_up(struct svc_serv *serv)
177 return rqstp; 178 return rqstp;
178} 179}
179 180
180static inline int nfs_minorversion_callback_svc_setup(u32 minorversion, 181static void nfs_minorversion_callback_svc_setup(struct svc_serv *serv,
181 struct svc_serv *serv,
182 struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp)) 182 struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp))
183{ 183{
184 if (minorversion) { 184 *rqstpp = nfs41_callback_up(serv);
185 *rqstpp = nfs41_callback_up(serv); 185 *callback_svc = nfs41_callback_svc;
186 *callback_svc = nfs41_callback_svc;
187 }
188 return minorversion;
189} 186}
190 187
191static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt, 188static 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 return 0; 201 return 0;
205} 202}
206 203
207static inline int nfs_minorversion_callback_svc_setup(u32 minorversion, 204static void nfs_minorversion_callback_svc_setup(struct svc_serv *serv,
208 struct svc_serv *serv,
209 struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp)) 205 struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp))
210{ 206{
211 return 0; 207 *rqstpp = ERR_PTR(-ENOTSUPP);
208 *callback_svc = ERR_PTR(-ENOTSUPP);
212} 209}
213 210
214static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt, 211static 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 struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion]; 222 struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion];
226 char svc_name[12]; 223 char svc_name[12];
227 int ret; 224 int ret;
228 int minorversion_setup;
229 225
230 nfs_callback_bc_serv(minorversion, xprt, serv); 226 nfs_callback_bc_serv(minorversion, xprt, serv);
231 227
232 if (cb_info->task) 228 if (cb_info->task)
233 return 0; 229 return 0;
234 230
235 minorversion_setup = nfs_minorversion_callback_svc_setup(minorversion, 231 switch (minorversion) {
236 serv, &rqstp, &callback_svc); 232 case 0:
237 if (!minorversion_setup) {
238 /* v4.0 callback setup */ 233 /* v4.0 callback setup */
239 rqstp = nfs4_callback_up(serv); 234 rqstp = nfs4_callback_up(serv);
240 callback_svc = nfs4_callback_svc; 235 callback_svc = nfs4_callback_svc;
236 break;
237 default:
238 nfs_minorversion_callback_svc_setup(serv,
239 &rqstp, &callback_svc);
241 } 240 }
242 241
243 if (IS_ERR(rqstp)) 242 if (IS_ERR(rqstp))