Whamcloud - gitweb
LU-2850 ptlrpc: handle sunrpc_cache_pipe_upcall change 96/8396/3
authorJames Simmons <uja.ornl@gmail.com>
Tue, 31 Dec 2013 16:44:02 +0000 (11:44 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 4 Jan 2014 03:20:09 +0000 (03:20 +0000)
Currently the ptlrpc GSS code has a wrapper to call
sunrpc_cache_pipe_upcall which takes three arguments.
The cache_request argument is already stored in the
cache_detail structure which is passed in already. So
for 3.8 the cache_request was removed with commit
21cd1254d3402a72927ed744e8ac1a7cf532f1ea. This patch
enabled Lustre to detect this change and run on newer
kernels.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I2be613d22aab5a0b8aa207a86e99fc63132affa0
Reviewed-on: http://review.whamcloud.com/8396
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Reviewed-by: Thomas Stibor <thomas@stibor.net>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/autoconf/lustre-core.m4
lustre/ptlrpc/gss/gss_svc_upcall.c

index 7f9bb45..87cadc7 100644 (file)
@@ -1188,7 +1188,7 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
-# 3.8 struct file has new memeber f_inode
+# 3.8 struct file has new member f_inode
 #
 AC_DEFUN([LC_HAVE_FILE_F_INODE],
 [AC_MSG_CHECKING([if struct file has memeber f_inode])
@@ -1205,6 +1205,21 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS],
+[AC_MSG_CHECKING([if sunrpc_cache_pipe_upcall takes 3 args])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/sunrpc/cache.h>
+],[
+       sunrpc_cache_pipe_upcall(NULL, NULL, NULL);
+],[
+       AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1,
+               [sunrpc_cache_pipe_upcall takes 3 args])
+       AC_MSG_RESULT([yes])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
 #
 # 3.9 uses hlist_for_each_entry with 3 args
 # b67bfe0d42cac56c512dd5da4b1b347a23f4b70a
@@ -1413,6 +1428,7 @@ AC_DEFUN([LC_PROG_LINUX],
 
         # 3.8
         LC_HAVE_FILE_F_INODE
+        LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
 
         # 3.9
         LC_HAVE_HLIST_FOR_EACH_3ARG
index 90967ed..b8d33ac 100644 (file)
@@ -161,26 +161,34 @@ static void rsi_request(struct cache_detail *cd,
                         struct cache_head *h,
                         char **bpp, int *blen)
 {
-        struct rsi *rsi = container_of(h, struct rsi, h);
-        __u64 index = 0;
-
-        /* if in_handle is null, provide kernel suggestion */
-        if (rsi->in_handle.len == 0)
-                index = gss_get_next_ctx_index();
-
-        qword_addhex(bpp, blen, (char *) &rsi->lustre_svc,
-                     sizeof(rsi->lustre_svc));
-        qword_addhex(bpp, blen, (char *) &rsi->nid, sizeof(rsi->nid));
-        qword_addhex(bpp, blen, (char *) &index, sizeof(index));
-        qword_addhex(bpp, blen, rsi->in_handle.data, rsi->in_handle.len);
-        qword_addhex(bpp, blen, rsi->in_token.data, rsi->in_token.len);
-        (*bpp)[-1] = '\n';
+       struct rsi *rsi = container_of(h, struct rsi, h);
+       __u64 index = 0;
+
+       /* if in_handle is null, provide kernel suggestion */
+       if (rsi->in_handle.len == 0)
+               index = gss_get_next_ctx_index();
+
+       qword_addhex(bpp, blen, (char *) &rsi->lustre_svc,
+                       sizeof(rsi->lustre_svc));
+       qword_addhex(bpp, blen, (char *) &rsi->nid, sizeof(rsi->nid));
+       qword_addhex(bpp, blen, (char *) &index, sizeof(index));
+       qword_addhex(bpp, blen, rsi->in_handle.data, rsi->in_handle.len);
+       qword_addhex(bpp, blen, rsi->in_token.data, rsi->in_token.len);
+       (*bpp)[-1] = '\n';
 }
 
+#ifdef HAVE_SUNRPC_UPCALL_HAS_3ARGS
 static int rsi_upcall(struct cache_detail *cd, struct cache_head *h)
 {
-        return sunrpc_cache_pipe_upcall(cd, h, rsi_request);
+       return sunrpc_cache_pipe_upcall(cd, h, rsi_request);
 }
+#else
+
+static int rsi_upcall(struct cache_detail *cd, struct cache_head *h)
+{
+       return sunrpc_cache_pipe_upcall(cd, h);
+}
+#endif
 
 static inline void __rsi_init(struct rsi *new, struct rsi *item)
 {
@@ -349,16 +357,19 @@ out:
 }
 
 static struct cache_detail rsi_cache = {
-        .hash_size      = RSI_HASHMAX,
-        .hash_table     = rsi_table,
-        .name           = "auth.sptlrpc.init",
-        .cache_put      = rsi_put,
-        .cache_upcall   = rsi_upcall,
-        .cache_parse    = rsi_parse,
-        .match          = rsi_match,
-        .init           = rsi_init,
-        .update         = update_rsi,
-        .alloc          = rsi_alloc,
+       .hash_size      = RSI_HASHMAX,
+       .hash_table     = rsi_table,
+       .name           = "auth.sptlrpc.init",
+       .cache_put      = rsi_put,
+#ifndef HAVE_SUNRPC_UPCALL_HAS_3ARGS
+       .cache_request  = rsi_request,
+#endif
+       .cache_upcall   = rsi_upcall,
+       .cache_parse    = rsi_parse,
+       .match          = rsi_match,
+       .init           = rsi_init,
+       .update         = update_rsi,
+       .alloc          = rsi_alloc,
 };
 
 static struct rsi *rsi_lookup(struct rsi *item)