Whamcloud - gitweb
LU-17015 gss: remove legacy sunrpc-cache based gss caches 76/52376/18
authorSebastien Buisson <sbuisson@ddn.com>
Thu, 14 Sep 2023 12:23:07 +0000 (14:23 +0200)
committerOleg Drokin <green@whamcloud.com>
Wed, 13 Dec 2023 12:20:36 +0000 (12:20 +0000)
Now that GSS caches are based on Lustre's internal upcall cache
mechanism, we can remove the legacy ones based on the sunrpc cache
implementation, as this code is unused.

We can also remove support for updated get_expiry() in Linux 6.3, as
this function is no longer used.

Test-Parameters: trivial
Test-Parameters: kerberos=true testlist=sanity-krb5
Test-Parameters: testgroup=review-dne-selinux-ssk-part-2
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I98d8777d225c723ae061ef360011abfc092e09d8
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52376
Reviewed-by: Aurelien Degremont <adegremont@nvidia.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/ptlrpc/gss/gss_internal.h
lustre/ptlrpc/gss/gss_svc_upcall.c
lustre/utils/gss/svcgssd_main_loop.c
lustre/utils/gss/svcgssd_proc.c

index d753843..89c09fb 100644 (file)
@@ -4051,29 +4051,6 @@ AC_DEFUN([LC_HAVE_CLASS_CREATE_MODULE_ARG], [
 ]) # LC_HAVE_CLASS_CREATE_MODULE_ARG
 
 #
-# LC_HAVE_GET_EXPIRY_TIME64_T
-#
-# linux kernel v6.3-rc7-2433-gcf64b9bce950
-#   SUNRPC: return proper error from get_expiry()
-#
-AC_DEFUN([LC_SRC_HAVE_GET_EXPIRY_TIME64_T], [
-       LB2_LINUX_TEST_SRC([get_expiry_with_time64_t], [
-               #include <linux/sunrpc/cache.h>
-       ],[
-               int err __attribute__ ((unused));
-
-               err = get_expiry((char **)NULL, (time64_t *)NULL);
-       ],[-Werror])
-])
-AC_DEFUN([LC_HAVE_GET_EXPIRY_TIME64_T], [
-       AC_MSG_CHECKING([if 'get_expiry' needs a time64_t arg])
-       LB2_LINUX_TEST_RESULT([get_expiry_with_time64_t], [
-               AC_DEFINE(HAVE_GET_EXPIRY_2ARGS, 1,
-                       ['get_expiry' takes time64_t])
-       ])
-]) # LC_HAVE_GET_EXPIRY_TIME64_T
-
-#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -4336,7 +4313,6 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [
        LC_SRC_HAVE_IOV_ITER_IOVEC
        LC_SRC_HAVE_IOVEC_WITH_IOV_MEMBER
        LC_SRC_HAVE_CLASS_CREATE_MODULE_ARG
-       LC_SRC_HAVE_GET_EXPIRY_TIME64_T
 
        # kernel patch to extend integrity interface
        LC_SRC_BIO_INTEGRITY_PREP_FN
@@ -4621,7 +4597,6 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [
        LC_HAVE_IOV_ITER_IOVEC
        LC_HAVE_IOVEC_WITH_IOV_MEMBER
        LC_HAVE_CLASS_CREATE_MODULE_ARG
-       LC_HAVE_GET_EXPIRY_TIME64_T
 
        # kernel patch to extend integrity interface
        LC_BIO_INTEGRITY_PREP_FN
index f1904e9..60c25cc 100644 (file)
@@ -236,15 +236,6 @@ static inline struct gss_sec_keyring *sec2gsec_keyring(struct ptlrpc_sec *sec)
         return container_of(sec2gsec(sec), struct gss_sec_keyring, gsk_base);
 }
 
-#ifdef HAVE_CACHE_HASH_SPINLOCK
-# define sunrpc_cache_lookup(c, i, h) sunrpc_cache_lookup_rcu((c), (i), (h))
-# define cache_read_lock(cdetail)   spin_lock(&((cdetail)->hash_lock))
-# define cache_read_unlock(cdetail) spin_unlock(&((cdetail)->hash_lock))
-#else /* ! HAVE_CACHE_HASH_SPINLOCK */
-# define cache_read_lock(cdetail)   read_lock(&((cdetail)->hash_lock))
-# define cache_read_unlock(cdetail) read_unlock(&((cdetail)->hash_lock))
-#endif
-
 #define GSS_CTX_INIT_MAX_LEN            (16384)
 
 /*
index 5894674..418587c 100644 (file)
@@ -54,7 +54,6 @@
 #include <linux/random.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
-#include <linux/sunrpc/cache.h>
 #include <linux/binfmts.h>
 #include <net/sock.h>
 #include <linux/un.h>
 #include "gss_api.h"
 #include "gss_crypto.h"
 
-#ifndef HAVE_GET_EXPIRY_2ARGS
-static inline int __get_expiry2(char **bpp, time64_t *rvp)
-{
-       *rvp = get_expiry(bpp);
-       return *rvp ? 0 : -EINVAL;
-}
-#define get_expiry(ps, pt)     __get_expiry2((ps), (pt))
-#endif
-
-#define GSS_SVC_UPCALL_TIMEOUT  (20)
-
 static DEFINE_SPINLOCK(__ctx_index_lock);
 static __u64 __ctx_index;
 
@@ -182,8 +170,6 @@ static inline unsigned long hash_mem_64(char *buf, int length, int bits)
  ****************************************/
 
 #define RSI_HASHBITS    (6)
-#define RSI_HASHMAX     (1 << RSI_HASHBITS)
-#define RSI_HASHMASK    (RSI_HASHMAX - 1)
 
 static void rsi_entry_init(struct upcall_cache_entry *entry,
                           void *args)
@@ -464,333 +450,11 @@ struct upcall_cache_ops rsi_upcall_cache_ops = {
 
 struct upcall_cache *rsicache;
 
-struct rsi {
-       struct cache_head       h;
-       __u32                   lustre_svc;
-       lnet_nid_t              nid4; /* FIXME Support larger NID */
-       char                    nm_name[LUSTRE_NODEMAP_NAME_LENGTH + 1];
-       wait_queue_head_t       waitq;
-       rawobj_t                in_handle, in_token;
-       rawobj_t                out_handle, out_token;
-       int                     major_status, minor_status;
-#ifdef HAVE_CACHE_HASH_SPINLOCK
-       struct rcu_head         rcu_head;
-#endif
-};
-
-#ifdef HAVE_CACHE_HEAD_HLIST
-static struct hlist_head rsi_table[RSI_HASHMAX];
-#else
-static struct cache_head *rsi_table[RSI_HASHMAX];
-#endif
-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,
-                        RSI_HASHBITS) ^
-               hash_mem((char *)item->in_token.data, item->in_token.len,
-                        RSI_HASHBITS);
-}
-
-static inline int __rsi_match(struct rsi *item, struct rsi *tmp)
-{
-        return (rawobj_equal(&item->in_handle, &tmp->in_handle) &&
-                rawobj_equal(&item->in_token, &tmp->in_token));
-}
-
-static void rsi_free(struct rsi *rsi)
-{
-        rawobj_free(&rsi->in_handle);
-        rawobj_free(&rsi->in_token);
-        rawobj_free(&rsi->out_handle);
-        rawobj_free(&rsi->out_token);
-}
-
-/* See handle_channel_req() userspace for where the upcall data is read */
-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->nid4, sizeof(rsi->nid4));
-       qword_addhex(bpp, blen, (char *) &index, sizeof(index));
-       qword_addhex(bpp, blen, (char *) rsi->nm_name,
-                    strlen(rsi->nm_name) + 1);
-       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';
-}
-
-static inline void __rsi_init(struct rsi *new, struct rsi *item)
-{
-       new->out_handle = RAWOBJ_EMPTY;
-       new->out_token = RAWOBJ_EMPTY;
-
-       new->in_handle = item->in_handle;
-       item->in_handle = RAWOBJ_EMPTY;
-       new->in_token = item->in_token;
-       item->in_token = RAWOBJ_EMPTY;
-
-       new->lustre_svc = item->lustre_svc;
-       new->nid4 = item->nid4;
-       memcpy(new->nm_name, item->nm_name, sizeof(item->nm_name));
-       init_waitqueue_head(&new->waitq);
-}
-
-static inline void __rsi_update(struct rsi *new, struct rsi *item)
-{
-        LASSERT(new->out_handle.len == 0);
-        LASSERT(new->out_token.len == 0);
-
-        new->out_handle = item->out_handle;
-        item->out_handle = RAWOBJ_EMPTY;
-        new->out_token = item->out_token;
-        item->out_token = RAWOBJ_EMPTY;
-
-        new->major_status = item->major_status;
-        new->minor_status = item->minor_status;
-}
-
-#ifdef HAVE_CACHE_HASH_SPINLOCK
-static void rsi_free_rcu(struct rcu_head *head)
-{
-       struct rsi *rsi = container_of(head, struct rsi, rcu_head);
-
-#ifdef HAVE_CACHE_HEAD_HLIST
-       LASSERT(hlist_unhashed(&rsi->h.cache_list));
-#else
-       LASSERT(rsi->h.next == NULL);
-#endif
-       rsi_free(rsi);
-       OBD_FREE_PTR(rsi);
-}
-
-static void rsi_put(struct kref *ref)
-{
-       struct rsi *rsi = container_of(ref, struct rsi, h.ref);
-
-       call_rcu(&rsi->rcu_head, rsi_free_rcu);
-}
-#else /* !HAVE_CACHE_HASH_SPINLOCK */
-static void rsi_put(struct kref *ref)
-{
-       struct rsi *rsi = container_of(ref, struct rsi, h.ref);
-
-#ifdef HAVE_CACHE_HEAD_HLIST
-       LASSERT(hlist_unhashed(&rsi->h.cache_list));
-#else
-       LASSERT(rsi->h.next == NULL);
-#endif
-       rsi_free(rsi);
-       OBD_FREE_PTR(rsi);
-}
-#endif /* HAVE_CACHE_HASH_SPINLOCK */
-
-static int rsi_match(struct cache_head *a, struct cache_head *b)
-{
-        struct rsi *item = container_of(a, struct rsi, h);
-        struct rsi *tmp = container_of(b, struct rsi, h);
-
-        return __rsi_match(item, tmp);
-}
-
-static void rsi_init(struct cache_head *cnew, struct cache_head *citem)
-{
-        struct rsi *new = container_of(cnew, struct rsi, h);
-        struct rsi *item = container_of(citem, struct rsi, h);
-
-        __rsi_init(new, item);
-}
-
-static void update_rsi(struct cache_head *cnew, struct cache_head *citem)
-{
-        struct rsi *new = container_of(cnew, struct rsi, h);
-        struct rsi *item = container_of(citem, struct rsi, h);
-
-        __rsi_update(new, item);
-}
-
-static struct cache_head *rsi_alloc(void)
-{
-        struct rsi *rsi;
-
-        OBD_ALLOC_PTR(rsi);
-        if (rsi) 
-                return &rsi->h;
-        else
-                return NULL;
-}
-
-static int rsi_parse(struct cache_detail *cd, char *mesg, int mlen)
-{
-       char *buf = mesg;
-       int len;
-       struct rsi rsii, *rsip = NULL;
-       time64_t expiry;
-       int status = -EINVAL;
-       ENTRY;
-
-       memset(&rsii, 0, sizeof(rsii));
-
-       /* handle */
-       len = qword_get(&mesg, buf, mlen);
-       if (len < 0)
-               goto out;
-       if (rawobj_alloc(&rsii.in_handle, buf, len)) {
-               status = -ENOMEM;
-               goto out;
-       }
-
-       /* token */
-       len = qword_get(&mesg, buf, mlen);
-       if (len < 0)
-               goto out;
-       if (rawobj_alloc(&rsii.in_token, buf, len)) {
-               status = -ENOMEM;
-               goto out;
-       }
-
-       rsip = rsi_lookup(&rsii);
-       if (!rsip)
-               goto out;
-       if (!test_bit(CACHE_PENDING, &rsip->h.flags)) {
-               /* If this is not a pending request, it probably means
-                * someone wrote arbitrary data to the init channel.
-                * Directly return -EINVAL in this case.
-                */
-               status = -EINVAL;
-               goto out;
-       }
-
-       rsii.h.flags = 0;
-       /* expiry */
-       status = get_expiry(&mesg, &expiry);
-       if (status)
-               goto out;
-
-       len = qword_get(&mesg, buf, mlen);
-       if (len <= 0)
-               goto out;
-
-       /* major */
-       status = kstrtoint(buf, 10, &rsii.major_status);
-       if (status)
-               goto out;
-
-       /* minor */
-       len = qword_get(&mesg, buf, mlen);
-       if (len <= 0) {
-               status = -EINVAL;
-               goto out;
-       }
-
-       status = kstrtoint(buf, 10, &rsii.minor_status);
-       if (status)
-               goto out;
-
-       /* out_handle */
-       len = qword_get(&mesg, buf, mlen);
-       if (len < 0)
-               goto out;
-       if (rawobj_alloc(&rsii.out_handle, buf, len)) {
-               status = -ENOMEM;
-               goto out;
-       }
-
-       /* out_token */
-       len = qword_get(&mesg, buf, mlen);
-       if (len < 0)
-               goto out;
-       if (rawobj_alloc(&rsii.out_token, buf, len)) {
-               status = -ENOMEM;
-               goto out;
-       }
-
-       rsii.h.expiry_time = expiry;
-       rsip = rsi_update(&rsii, rsip);
-       status = 0;
-out:
-       rsi_free(&rsii);
-       if (rsip) {
-               wake_up(&rsip->waitq);
-               cache_put(&rsip->h, &rsi_cache);
-       } else {
-               status = -ENOMEM;
-       }
-
-       if (status)
-               CERROR("rsi parse error %d\n", status);
-       RETURN(status);
-}
-
-static struct cache_detail rsi_cache = {
-       .hash_size      = RSI_HASHMAX,
-       .hash_table     = rsi_table,
-       .name           = "auth.sptlrpc.init",
-       .cache_put      = rsi_put,
-       .cache_request  = rsi_request,
-       .cache_upcall   = sunrpc_cache_pipe_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)
-{
-        struct cache_head *ch;
-        int hash = rsi_hash(item);
-
-        ch = sunrpc_cache_lookup(&rsi_cache, &item->h, hash);
-        if (ch)
-                return container_of(ch, struct rsi, h);
-        else
-                return NULL;
-}
-
-static struct rsi *rsi_update(struct rsi *new, struct rsi *old)
-{
-        struct cache_head *ch;
-        int hash = rsi_hash(new);
-
-        ch = sunrpc_cache_update(&rsi_cache, &new->h, &old->h, hash);
-        if (ch)
-                return container_of(ch, struct rsi, h);
-        else
-                return NULL;
-}
-
 /****************************************
  * rpc sec context (rsc) cache         *
  ****************************************/
 
 #define RSC_HASHBITS    (10)
-#define RSC_HASHMAX     (1 << RSC_HASHBITS)
-#define RSC_HASHMASK    (RSC_HASHMAX - 1)
 
 static void rsc_entry_init(struct upcall_cache_entry *entry,
                           void *args)
@@ -992,315 +656,6 @@ struct upcall_cache_ops rsc_upcall_cache_ops = {
 
 struct upcall_cache *rsccache;
 
-struct rsc {
-        struct cache_head       h;
-        struct obd_device      *target;
-        rawobj_t                handle;
-        struct gss_svc_ctx      ctx;
-#ifdef HAVE_CACHE_HASH_SPINLOCK
-       struct rcu_head         rcu_head;
-#endif
-};
-
-#ifdef HAVE_CACHE_HEAD_HLIST
-static struct hlist_head rsc_table[RSC_HASHMAX];
-#else
-static struct cache_head *rsc_table[RSC_HASHMAX];
-#endif
-static struct cache_detail rsc_cache;
-static struct rsc *rsc_update(struct rsc *new, struct rsc *old);
-static struct rsc *rsc_lookup(struct rsc *item);
-
-static void rsc_free(struct rsc *rsci)
-{
-        rawobj_free(&rsci->handle);
-        rawobj_free(&rsci->ctx.gsc_rvs_hdl);
-        lgss_delete_sec_context(&rsci->ctx.gsc_mechctx);
-}
-
-static inline int rsc_hash(struct rsc *rsci)
-{
-        return hash_mem((char *)rsci->handle.data,
-                        rsci->handle.len, RSC_HASHBITS);
-}
-
-static inline int __rsc_match(struct rsc *new, struct rsc *tmp)
-{
-        return rawobj_equal(&new->handle, &tmp->handle);
-}
-
-static inline void __rsc_init(struct rsc *new, struct rsc *tmp)
-{
-        new->handle = tmp->handle;
-        tmp->handle = RAWOBJ_EMPTY;
-
-        new->target = NULL;
-        memset(&new->ctx, 0, sizeof(new->ctx));
-        new->ctx.gsc_rvs_hdl = RAWOBJ_EMPTY;
-}
-
-static inline void __rsc_update(struct rsc *new, struct rsc *tmp)
-{
-       new->ctx = tmp->ctx;
-       memset(&tmp->ctx, 0, sizeof(tmp->ctx));
-       tmp->ctx.gsc_rvs_hdl = RAWOBJ_EMPTY;
-       tmp->ctx.gsc_mechctx = NULL;
-       tmp->target = NULL;
-
-       memset(&new->ctx.gsc_seqdata, 0, sizeof(new->ctx.gsc_seqdata));
-       spin_lock_init(&new->ctx.gsc_seqdata.ssd_lock);
-}
-
-#ifdef HAVE_CACHE_HASH_SPINLOCK
-static void rsc_free_rcu(struct rcu_head *head)
-{
-       struct rsc *rsci = container_of(head, struct rsc, rcu_head);
-
-#ifdef HAVE_CACHE_HEAD_HLIST
-       LASSERT(hlist_unhashed(&rsci->h.cache_list));
-#else
-       LASSERT(rsci->h.next == NULL);
-#endif
-       rawobj_free(&rsci->handle);
-       OBD_FREE_PTR(rsci);
-}
-
-static void rsc_put(struct kref *ref)
-{
-       struct rsc *rsci = container_of(ref, struct rsc, h.ref);
-
-       rawobj_free(&rsci->ctx.gsc_rvs_hdl);
-       lgss_delete_sec_context(&rsci->ctx.gsc_mechctx);
-       call_rcu(&rsci->rcu_head, rsc_free_rcu);
-}
-#else /* !HAVE_CACHE_HASH_SPINLOCK */
-static void rsc_put(struct kref *ref)
-{
-       struct rsc *rsci = container_of(ref, struct rsc, h.ref);
-
-#ifdef HAVE_CACHE_HEAD_HLIST
-       LASSERT(hlist_unhashed(&rsci->h.cache_list));
-#else
-       LASSERT(rsci->h.next == NULL);
-#endif
-       rsc_free(rsci);
-       OBD_FREE_PTR(rsci);
-}
-#endif /* HAVE_CACHE_HASH_SPINLOCK */
-
-static int rsc_match(struct cache_head *a, struct cache_head *b)
-{
-        struct rsc *new = container_of(a, struct rsc, h);
-        struct rsc *tmp = container_of(b, struct rsc, h);
-
-        return __rsc_match(new, tmp);
-}
-
-static void rsc_init(struct cache_head *cnew, struct cache_head *ctmp)
-{
-        struct rsc *new = container_of(cnew, struct rsc, h);
-        struct rsc *tmp = container_of(ctmp, struct rsc, h);
-
-        __rsc_init(new, tmp);
-}
-
-static void update_rsc(struct cache_head *cnew, struct cache_head *ctmp)
-{
-        struct rsc *new = container_of(cnew, struct rsc, h);
-        struct rsc *tmp = container_of(ctmp, struct rsc, h);
-
-        __rsc_update(new, tmp);
-}
-
-static struct cache_head * rsc_alloc(void)
-{
-        struct rsc *rsc;
-
-        OBD_ALLOC_PTR(rsc);
-        if (rsc)
-                return &rsc->h;
-        else
-                return NULL;
-}
-
-static int rsc_parse(struct cache_detail *cd, char *mesg, int mlen)
-{
-       char *buf = mesg;
-       int len, rv, tmp_int;
-       struct rsc rsci, *rscp = NULL;
-       time64_t expiry;
-       int status = -EINVAL;
-       struct gss_api_mech *gm = NULL;
-
-       memset(&rsci, 0, sizeof(rsci));
-
-       /* context handle */
-       len = qword_get(&mesg, buf, mlen);
-       if (len < 0)
-               goto out;
-
-       status = -ENOMEM;
-       if (rawobj_alloc(&rsci.handle, buf, len))
-               goto out;
-
-       rsci.h.flags = 0;
-       /* expiry */
-       status = get_expiry(&mesg, &expiry);
-       if (status)
-               goto out;
-
-       status = -EINVAL;
-       /* remote flag */
-       rv = get_int(&mesg, &tmp_int);
-       if (rv) {
-               CERROR("fail to get remote flag\n");
-               goto out;
-       }
-       rsci.ctx.gsc_remote = (tmp_int != 0);
-
-       /* root user flag */
-       rv = get_int(&mesg, &tmp_int);
-       if (rv) {
-               CERROR("fail to get root user flag\n");
-               goto out;
-       }
-       rsci.ctx.gsc_usr_root = (tmp_int != 0);
-
-       /* mds user flag */
-       rv = get_int(&mesg, &tmp_int);
-       if (rv) {
-               CERROR("fail to get mds user flag\n");
-               goto out;
-       }
-       rsci.ctx.gsc_usr_mds = (tmp_int != 0);
-
-       /* oss user flag */
-       rv = get_int(&mesg, &tmp_int);
-       if (rv) {
-               CERROR("fail to get oss user flag\n");
-               goto out;
-       }
-       rsci.ctx.gsc_usr_oss = (tmp_int != 0);
-
-       /* mapped uid */
-       rv = get_int(&mesg, (int *) &rsci.ctx.gsc_mapped_uid);
-       if (rv) {
-               CERROR("fail to get mapped uid\n");
-               goto out;
-       }
-
-       rscp = rsc_lookup(&rsci);
-       if (!rscp)
-               goto out;
-
-       /* uid, or NEGATIVE */
-       rv = get_int(&mesg, (int *) &rsci.ctx.gsc_uid);
-       if (rv == -EINVAL)
-               goto out;
-       if (rv == -ENOENT) {
-               CERROR("NOENT? set rsc entry negative\n");
-               set_bit(CACHE_NEGATIVE, &rsci.h.flags);
-       } else {
-               rawobj_t tmp_buf;
-               time64_t ctx_expiry;
-
-               /* gid */
-               if (get_int(&mesg, (int *) &rsci.ctx.gsc_gid))
-                       goto out;
-
-               /* mech name */
-               len = qword_get(&mesg, buf, mlen);
-               if (len < 0)
-                       goto out;
-               gm = lgss_name_to_mech(buf);
-               status = -EOPNOTSUPP;
-               if (!gm)
-                       goto out;
-
-               status = -EINVAL;
-               /* mech-specific data: */
-               len = qword_get(&mesg, buf, mlen);
-               if (len < 0)
-                       goto out;
-
-               tmp_buf.len = len;
-               tmp_buf.data = (unsigned char *)buf;
-               if (lgss_import_sec_context(&tmp_buf, gm,
-                                           &rsci.ctx.gsc_mechctx))
-                       goto out;
-
-               /* set to seconds since machine booted */
-               expiry = ktime_get_seconds();
-
-               /* currently the expiry time passed down from user-space
-                * is invalid, here we retrive it from mech.
-                */
-               if (lgss_inquire_context(rsci.ctx.gsc_mechctx, &ctx_expiry)) {
-                       CERROR("unable to get expire time, drop it\n");
-                       goto out;
-               }
-
-               /* ctx_expiry is the number of seconds since Jan 1 1970.
-                * We want just the  number of seconds into the future.
-                */
-               expiry += ctx_expiry - ktime_get_real_seconds();
-       }
-
-       rsci.h.expiry_time = expiry;
-       rscp = rsc_update(&rsci, rscp);
-       status = 0;
-out:
-       if (gm)
-               lgss_mech_put(gm);
-       rsc_free(&rsci);
-       if (rscp)
-               cache_put(&rscp->h, &rsc_cache);
-       else
-               status = -ENOMEM;
-
-       if (status)
-               CERROR("parse rsc error %d\n", status);
-       return status;
-}
-
-static struct cache_detail rsc_cache = {
-        .hash_size      = RSC_HASHMAX,
-        .hash_table     = rsc_table,
-        .name           = "auth.sptlrpc.context",
-        .cache_put      = rsc_put,
-        .cache_parse    = rsc_parse,
-        .match          = rsc_match,
-        .init           = rsc_init,
-        .update         = update_rsc,
-        .alloc          = rsc_alloc,
-};
-
-static struct rsc *rsc_lookup(struct rsc *item)
-{
-        struct cache_head *ch;
-        int                hash = rsc_hash(item);
-
-        ch = sunrpc_cache_lookup(&rsc_cache, &item->h, hash);
-        if (ch)
-                return container_of(ch, struct rsc, h);
-        else
-                return NULL;
-}
-
-static struct rsc *rsc_update(struct rsc *new, struct rsc *old)
-{
-        struct cache_head *ch;
-        int                hash = rsc_hash(new);
-
-        ch = sunrpc_cache_update(&rsc_cache, &new->h, &old->h, hash);
-        if (ch)
-                return container_of(ch, struct rsc, h);
-        else
-                return NULL;
-}
-
-#define COMPAT_RSC_PUT(item, cd)        cache_put((item), (cd))
-
 /****************************************
  * rsc cache flush                      *
  ****************************************/
@@ -1699,24 +1054,6 @@ int __init gss_init_svc_upcall(void)
         */
        get_random_bytes(&__ctx_index, sizeof(__ctx_index));
 
-#ifdef HAVE_CACHE_HEAD_HLIST
-       for (rc = 0; rc < rsi_cache.hash_size; rc++)
-               INIT_HLIST_HEAD(&rsi_cache.hash_table[rc]);
-#endif
-       rc = cache_register_net(&rsi_cache, &init_net);
-       if (rc != 0)
-               return rc;
-
-#ifdef HAVE_CACHE_HEAD_HLIST
-       for (rc = 0; rc < rsc_cache.hash_size; rc++)
-               INIT_HLIST_HEAD(&rsc_cache.hash_table[rc]);
-#endif
-       rc = cache_register_net(&rsc_cache, &init_net);
-       if (rc != 0) {
-               cache_unregister_net(&rsi_cache, &init_net);
-               return rc;
-       }
-
        rsicache = upcall_cache_init(RSI_CACHE_NAME, RSI_UPCALL_PATH,
                                     UC_RSICACHE_HASH_SIZE,
                                     3600, /* entry expire: 1 h */
@@ -1751,12 +1088,6 @@ int __init gss_init_svc_upcall(void)
 
 void gss_exit_svc_upcall(void)
 {
-       cache_purge(&rsi_cache);
-       cache_unregister_net(&rsi_cache, &init_net);
-
-       cache_purge(&rsc_cache);
-       cache_unregister_net(&rsc_cache, &init_net);
-
        upcall_cache_cleanup(rsicache);
        upcall_cache_cleanup(rsccache);
 }
index 7758013..b0d9f89 100644 (file)
@@ -52,7 +52,6 @@
 #include "err_util.h"
 #include "sk_utils.h"
 
-#define GSS_RPC_FILE "/proc/net/rpc/auth.sptlrpc.init/channel"
 /* max allowed time for prime testing: 400 ms */
 #define MAX_ALLOWED_TIME_FOR_PRIME 400000
 int sk_dh_checks;
index b3c9889..fa61a74 100644 (file)
@@ -63,9 +63,6 @@
 #include <gssapi/gssapi_krb5.h>
 #include <libcfs/util/param.h>
 
-#define SVCGSSD_CONTEXT_CHANNEL "/proc/net/rpc/auth.sptlrpc.context/channel"
-#define SVCGSSD_INIT_CHANNEL    "/proc/net/rpc/auth.sptlrpc.init/channel"
-
 struct svc_cred {
        uint32_t cr_remote;
        uint32_t cr_usr_root;
@@ -178,11 +175,6 @@ out:
        return rc;
 }
 
-struct gss_verifier {
-       u_int32_t       flav;
-       gss_buffer_desc body;
-};
-
 #define RPCSEC_GSS_SEQ_WIN     5
 
 static int send_response(int auth_res, uint64_t hash,