From ddb2d29c72e3cee17fbd5565dc247977e670ac04 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Tue, 31 Dec 2013 11:44:02 -0500 Subject: [PATCH] LU-2850 ptlrpc: handle sunrpc_cache_pipe_upcall change 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 Change-Id: I2be613d22aab5a0b8aa207a86e99fc63132affa0 Reviewed-on: http://review.whamcloud.com/8396 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Peng Tao Reviewed-by: Thomas Stibor Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 18 ++++++++++- lustre/ptlrpc/gss/gss_svc_upcall.c | 61 ++++++++++++++++++++++---------------- 2 files changed, 53 insertions(+), 26 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 7f9bb45..87cadc7 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +],[ + 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 diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index 90967ed..b8d33ac 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -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) -- 1.8.3.1