From: Shaun Tancheff Date: Tue, 17 Dec 2019 04:29:15 +0000 (-0600) Subject: LU-12904 gss: struct cache_detail readers changed to writers X-Git-Tag: 2.13.51~34 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=81fb8bc7d214394bbc504379a5a84441e871b60a LU-12904 gss: struct cache_detail readers changed to writers Linux 5.3 changed struct cache_detail readers to writers SUNRPC: Track writers of the 'channel' file to improve ... kernel-commit: 64a38e840ce5940253208eaba40265c73decc4ee Test-Parameters: trivial Cray-bug-id: LUS-8042 Signed-off-by: Shaun Tancheff Change-Id: I7750303937cd6fc560e458efa79f25e521fefec7 Reviewed-on: https://review.whamcloud.com/36580 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Sebastien Buisson Reviewed-by: James Simmons Reviewed-by: Petros Koutoupis Reviewed-by: Oleg Drokin --- diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index 9fd7e10..32c5caf 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -1290,6 +1290,29 @@ EXTRA_KCFLAGS="$tmp_flags" ]) # LIBCFS_FORCE_SIG_WITH_TASK # +# LIBCFS_CACHE_DETAIL_WRITERS +# +# kernel v5.3-rc2-1-g64a38e840ce5 +# SUNRPC: Track writers of the 'channel' file to improve cache_listeners_exist +# +AC_DEFUN([LIBCFS_CACHE_DETAIL_WRITERS], [ +tmp_flags="$EXTRA_KCFLAGS" +EXTRA_KCFLAGS="-Werror" +LB_CHECK_COMPILE([if struct cache_detail has writers], +cache_detail_writers_atomic, [ + #include + + static struct cache_detail rsi_cache; +],[ + atomic_set(&rsi_cache.writers, 0); +],[ + AC_DEFINE(HAVE_CACHE_DETAIL_WRITERS, 1, + [struct cache_detail has writers]) +]) +EXTRA_KCFLAGS="$tmp_flags" +]) # LIBCFS_CACHE_DETAIL_WRITERS + +# # LIBCFS_PROG_LINUX # # LibCFS linux kernel checks @@ -1405,6 +1428,7 @@ LIBCFS_HAVE_IOV_ITER_TYPE LIBCFS_MM_TOTALRAM_PAGES_FUNC # 5.3 LIBCFS_FORCE_SIG_WITH_TASK +LIBCFS_CACHE_DETAIL_WRITERS ]) # LIBCFS_PROG_LINUX # diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index f5edaf0..1c643ec 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -163,6 +163,18 @@ static struct cache_detail rsi_cache; static struct rsi *rsi_update(struct rsi *new, struct rsi *old); static struct rsi *rsi_lookup(struct rsi *item); +#ifdef HAVE_CACHE_DETAIL_WRITERS +static inline int channel_users(struct cache_detail *cd) +{ + return atomic_read(&cd->writers); +} +#else +static inline int channel_users(struct cache_detail *cd) +{ + return atomic_read(&cd->readers); +} +#endif + static inline int rsi_hash(struct rsi *item) { return hash_mem((char *)item->in_handle.data, item->in_handle.len, @@ -1125,13 +1137,13 @@ int __init gss_init_svc_upcall(void) * Here we wait at minimum 1.5 seconds. */ for (i = 0; i < 6; i++) { - if (atomic_read(&rsi_cache.readers) > 0) + if (channel_users(&rsi_cache) > 0) break; set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(cfs_time_seconds(1) / 4); } - if (atomic_read(&rsi_cache.readers) == 0) + if (channel_users(&rsi_cache) == 0) CWARN("Init channel is not opened by lsvcgssd, following " "request might be dropped until lsvcgssd is active\n");