Whamcloud - gitweb
LU-709 build: clean up LC_STRUCT_INTENT_FILE and LC_SUNRPC_CACHE
authorPeng Tao <peng_tao@emc.com>
Mon, 23 Jan 2012 02:52:12 +0000 (10:52 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 30 Apr 2012 01:48:39 +0000 (21:48 -0400)
1. open_intent.file was added since v2.6.14
2. cache_head.ref was added since v2.6.16

Signed-off-by: Peng Tao <peng_tao@emc.com>
Change-Id: Ie4047431f56cf71ef7a17115c2cd1a3812256419
Reviewed-on: http://review.whamcloud.com/2314
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/llite/dcache.c
lustre/llite/namei.c
lustre/ptlrpc/gss/gss_svc_upcall.c

index e1a6146..5e4f034 100644 (file)
@@ -379,24 +379,6 @@ AC_TRY_RUN([
 CFLAGS="$tmp_flags"
 ])
 
 CFLAGS="$tmp_flags"
 ])
 
-# added in 2.6.16
-#
-AC_DEFUN([LC_STRUCT_INTENT_FILE],
-[AC_MSG_CHECKING([if struct open_intent has a file field])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/fs.h>
-        #include <linux/namei.h>
-],[
-        struct open_intent intent;
-        &intent.file;
-],[
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
 #
 # LC_CAPA_CRYPTO
 #
 #
 # LC_CAPA_CRYPTO
 #
@@ -447,25 +429,9 @@ AC_DEFUN([LC_CONFIG_GSS_KEYRING],
  fi
 ])
 
  fi
 ])
 
-AC_DEFUN([LC_SUNRPC_CACHE],
-[AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/sunrpc/cache.h>
-],[
-        struct cache_head ch;
-        &ch.ref.refcount;
-],[
-        AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
 AC_DEFUN([LC_CONFIG_SUNRPC],
 [LB_LINUX_CONFIG_IM([SUNRPC],[],
                     [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
 AC_DEFUN([LC_CONFIG_SUNRPC],
 [LB_LINUX_CONFIG_IM([SUNRPC],[],
                     [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
- LC_SUNRPC_CACHE
 ])
 
 #
 ])
 
 #
@@ -2074,8 +2040,6 @@ AC_DEFUN([LC_PROG_LINUX],
 
          LC_CONST_ACL_SIZE
 
 
          LC_CONST_ACL_SIZE
 
-         LC_STRUCT_INTENT_FILE
-
          LC_CAPA_CRYPTO
          LC_CONFIG_RMTCLIENT
          LC_CONFIG_GSS
          LC_CAPA_CRYPTO
          LC_CONFIG_RMTCLIENT
          LC_CONFIG_GSS
index 07c4af4..0c24635 100644 (file)
@@ -670,7 +670,6 @@ int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
 
                 if (rc && (nd->flags & LOOKUP_OPEN) &&
                     it_disposition(it, DISP_OPEN_OPEN)) {/*Open*/
 
                 if (rc && (nd->flags & LOOKUP_OPEN) &&
                     it_disposition(it, DISP_OPEN_OPEN)) {/*Open*/
-#ifdef HAVE_FILE_IN_STRUCT_INTENT
 // XXX Code duplication with ll_lookup_nd
                         if (S_ISFIFO(dentry->d_inode->i_mode)) {
                                 // We cannot call open here as it would
 // XXX Code duplication with ll_lookup_nd
                         if (S_ISFIFO(dentry->d_inode->i_mode)) {
                                 // We cannot call open here as it would
@@ -695,9 +694,6 @@ int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
                                 (void)lookup_instantiate_filp(nd, dentry,NULL);
 #endif
                         }
                                 (void)lookup_instantiate_filp(nd, dentry,NULL);
 #endif
                         }
-#else
-                        ll_release_openhandle(dentry, it);
-#endif /* HAVE_FILE_IN_STRUCT_INTENT */
                 }
                 if (!rc && (nd->flags & LOOKUP_CREATE) &&
                     it_disposition(it, DISP_OPEN_CREATE)) {
                 }
                 if (!rc && (nd->flags & LOOKUP_CREATE) &&
                     it_disposition(it, DISP_OPEN_CREATE)) {
index 06a4a67..c6715a2 100644 (file)
@@ -624,14 +624,6 @@ struct lookup_intent *ll_convert_intent(struct open_intent *oit,
                 it->it_op = IT_GETATTR;
         }
 
                 it->it_op = IT_GETATTR;
         }
 
-#ifndef HAVE_FILE_IN_STRUCT_INTENT
-                /* Since there is no way to pass our intent to ll_file_open,
-                 * just check the file is there. Actual open will be done
-                 * in ll_file_open */
-                if (it->it_op & IT_OPEN)
-                        it->it_op = IT_LOOKUP;
-#endif
-
         return it;
 }
 
         return it;
 }
 
@@ -644,7 +636,7 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
         if (nd && !(nd->flags & (LOOKUP_CONTINUE|LOOKUP_PARENT))) {
                 struct lookup_intent *it;
 
         if (nd && !(nd->flags & (LOOKUP_CONTINUE|LOOKUP_PARENT))) {
                 struct lookup_intent *it;
 
-#if defined(HAVE_FILE_IN_STRUCT_INTENT) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
                 /* Did we came here from failed revalidate just to propagate
                  * its error? */
                 if (nd->flags & LOOKUP_OPEN)
                 /* Did we came here from failed revalidate just to propagate
                  * its error? */
                 if (nd->flags & LOOKUP_OPEN)
@@ -672,7 +664,6 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
                 if ((nd->flags & LOOKUP_OPEN) && !IS_ERR(dentry)) { /* Open */
                         if (dentry->d_inode &&
                             it_disposition(it, DISP_OPEN_OPEN)) { /* nocreate */
                 if ((nd->flags & LOOKUP_OPEN) && !IS_ERR(dentry)) { /* Open */
                         if (dentry->d_inode &&
                             it_disposition(it, DISP_OPEN_OPEN)) { /* nocreate */
-#ifdef HAVE_FILE_IN_STRUCT_INTENT
                                 if (S_ISFIFO(dentry->d_inode->i_mode)) {
                                         // We cannot call open here as it would
                                         // deadlock.
                                 if (S_ISFIFO(dentry->d_inode->i_mode)) {
                                         // We cannot call open here as it would
                                         // deadlock.
@@ -700,11 +691,6 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
 #endif
 
                                 }
 #endif
 
                                 }
-#else /* HAVE_FILE_IN_STRUCT_INTENT */
-                                /* Release open handle as we have no way to
-                                 * pass it to ll_file_open */
-                                ll_release_openhandle(dentry, it);
-#endif /* HAVE_FILE_IN_STRUCT_INTENT */
                         } else if (it_disposition(it, DISP_OPEN_CREATE)) {
                                 // XXX This can only reliably work on assumption
                                 // that there are NO hashed negative dentries.
                         } else if (it_disposition(it, DISP_OPEN_CREATE)) {
                                 // XXX This can only reliably work on assumption
                                 // that there are NO hashed negative dentries.
@@ -923,14 +909,10 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry,
         }
 
         rc = ll_create_it(dir, dentry, mode, it);
         }
 
         rc = ll_create_it(dir, dentry, mode, it);
-#ifdef HAVE_FILE_IN_STRUCT_INTENT
         if (nd && (nd->flags & LOOKUP_OPEN) && dentry->d_inode) { /* Open */
                 nd->intent.open.file->private_data = it;
                 lookup_instantiate_filp(nd, dentry, NULL);
         }
         if (nd && (nd->flags & LOOKUP_OPEN) && dentry->d_inode) { /* Open */
                 nd->intent.open.file->private_data = it;
                 lookup_instantiate_filp(nd, dentry, NULL);
         }
-#else
-        ll_release_openhandle(dentry,it);
-#endif
 
 out:
         ll_intent_release(it);
 
 out:
         ll_intent_release(it);
index 7485c67..9d2d79f 100644 (file)
@@ -134,12 +134,8 @@ struct rsi {
 
 static struct cache_head *rsi_table[RSI_HASHMAX];
 static struct cache_detail rsi_cache;
 
 static struct cache_head *rsi_table[RSI_HASHMAX];
 static struct cache_detail rsi_cache;
-#ifdef HAVE_SUNRPC_CACHE_V2
 static struct rsi *rsi_update(struct rsi *new, struct rsi *old);
 static struct rsi *rsi_lookup(struct rsi *item);
 static struct rsi *rsi_update(struct rsi *new, struct rsi *old);
 static struct rsi *rsi_lookup(struct rsi *item);
-#else
-static struct rsi *rsi_lookup(struct rsi *item, int set);
-#endif
 
 static inline int rsi_hash(struct rsi *item)
 {
 
 static inline int rsi_hash(struct rsi *item)
 {
@@ -219,8 +215,6 @@ static inline void __rsi_update(struct rsi *new, struct rsi *item)
         new->minor_status = item->minor_status;
 }
 
         new->minor_status = item->minor_status;
 }
 
-#ifdef HAVE_SUNRPC_CACHE_V2
-
 static void rsi_put(struct kref *ref)
 {
         struct rsi *rsi = container_of(ref, struct rsi, h.ref);
 static void rsi_put(struct kref *ref)
 {
         struct rsi *rsi = container_of(ref, struct rsi, h.ref);
@@ -358,124 +352,6 @@ out:
         RETURN(status);
 }
 
         RETURN(status);
 }
 
-#else /* !HAVE_SUNRPC_CACHE_V2 */
-
-static void rsi_put(struct cache_head *item, struct cache_detail *cd)
-{
-        struct rsi *rsi = container_of(item, struct rsi, h);
-
-        LASSERT(cfs_atomic_read(&item->refcnt) > 0);
-
-        if (cache_put(item, cd)) {
-                LASSERT(item->next == NULL);
-                rsi_free(rsi);
-                kfree(rsi); /* created by cache mgmt using kmalloc */
-        }
-}
-
-static inline int rsi_match(struct rsi *item, struct rsi *tmp)
-{
-        return __rsi_match(item, tmp);
-}
-
-static inline void rsi_init(struct rsi *new, struct rsi *item)
-{
-        __rsi_init(new, item);
-}
-
-static inline void rsi_update(struct rsi *new, struct rsi *item)
-{
-        __rsi_update(new, item);
-}
-
-static int rsi_parse(struct cache_detail *cd, char *mesg, int mlen)
-{
-        char           *buf = mesg;
-        char           *ep;
-        int             len;
-        struct rsi      rsii, *rsip = NULL;
-        time_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;
-        }
-
-        /* expiry */
-        expiry = get_expiry(&mesg);
-        if (expiry == 0)
-                goto out;
-
-        len = qword_get(&mesg, buf, mlen);
-        if (len <= 0)
-                goto out;
-
-        /* major */
-        rsii.major_status = simple_strtol(buf, &ep, 10);
-        if (*ep)
-                goto out;
-
-        /* minor */
-        len = qword_get(&mesg, buf, mlen);
-        if (len <= 0)
-                goto out;
-        rsii.minor_status = simple_strtol(buf, &ep, 10);
-        if (*ep)
-                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_lookup(&rsii, 1);
-        status = 0;
-out:
-        rsi_free(&rsii);
-        if (rsip) {
-                cfs_waitq_broadcast(&rsip->waitq);
-                rsi_put(&rsip->h, &rsi_cache);
-        }
-
-        if (status)
-                CERROR("rsi parse error %d\n", status);
-        RETURN(status);
-}
-
-#endif /* HAVE_SUNRPC_CACHE_V2 */
-
 static struct cache_detail rsi_cache = {
         .hash_size      = RSI_HASHMAX,
         .hash_table     = rsi_table,
 static struct cache_detail rsi_cache = {
         .hash_size      = RSI_HASHMAX,
         .hash_table     = rsi_table,
@@ -487,16 +363,12 @@ static struct cache_detail rsi_cache = {
         .cache_request  = rsi_request,
 #endif
         .cache_parse    = rsi_parse,
         .cache_request  = rsi_request,
 #endif
         .cache_parse    = rsi_parse,
-#ifdef HAVE_SUNRPC_CACHE_V2
         .match          = rsi_match,
         .init           = rsi_init,
         .update         = update_rsi,
         .alloc          = rsi_alloc,
         .match          = rsi_match,
         .init           = rsi_init,
         .update         = update_rsi,
         .alloc          = rsi_alloc,
-#endif
 };
 
 };
 
-#ifdef HAVE_SUNRPC_CACHE_V2
-
 static struct rsi *rsi_lookup(struct rsi *item)
 {
         struct cache_head *ch;
 static struct rsi *rsi_lookup(struct rsi *item)
 {
         struct cache_head *ch;
@@ -521,12 +393,6 @@ static struct rsi *rsi_update(struct rsi *new, struct rsi *old)
                 return NULL;
 }
 
                 return NULL;
 }
 
-#else
-
-static DefineSimpleCacheLookup(rsi, 0)
-
-#endif
-
 /****************************************
  * rsc cache                            *
  ****************************************/
 /****************************************
  * rsc cache                            *
  ****************************************/
@@ -544,12 +410,8 @@ struct rsc {
 
 static struct cache_head *rsc_table[RSC_HASHMAX];
 static struct cache_detail rsc_cache;
 
 static struct cache_head *rsc_table[RSC_HASHMAX];
 static struct cache_detail rsc_cache;
-#ifdef HAVE_SUNRPC_CACHE_V2
 static struct rsc *rsc_update(struct rsc *new, struct rsc *old);
 static struct rsc *rsc_lookup(struct rsc *item);
 static struct rsc *rsc_update(struct rsc *new, struct rsc *old);
 static struct rsc *rsc_lookup(struct rsc *item);
-#else
-static struct rsc *rsc_lookup(struct rsc *item, int set);
-#endif
 
 static void rsc_free(struct rsc *rsci)
 {
 
 static void rsc_free(struct rsc *rsci)
 {
@@ -589,8 +451,6 @@ static inline void __rsc_update(struct rsc *new, struct rsc *tmp)
         cfs_spin_lock_init(&new->ctx.gsc_seqdata.ssd_lock);
 }
 
         cfs_spin_lock_init(&new->ctx.gsc_seqdata.ssd_lock);
 }
 
-#ifdef HAVE_SUNRPC_CACHE_V2
-
 static void rsc_put(struct kref *ref)
 {
         struct rsc *rsci = container_of(ref, struct rsc, h.ref);
 static void rsc_put(struct kref *ref)
 {
         struct rsc *rsci = container_of(ref, struct rsc, h.ref);
@@ -765,183 +625,18 @@ out:
         return status;
 }
 
         return status;
 }
 
-#else /* !HAVE_SUNRPC_CACHE_V2 */
-
-static void rsc_put(struct cache_head *item, struct cache_detail *cd)
-{
-        struct rsc *rsci = container_of(item, struct rsc, h);
-
-        LASSERT(cfs_atomic_read(&item->refcnt) > 0);
-
-        if (cache_put(item, cd)) {
-                LASSERT(item->next == NULL);
-                rsc_free(rsci);
-                kfree(rsci); /* created by cache mgmt using kmalloc */
-        }
-}
-
-static inline int rsc_match(struct rsc *new, struct rsc *tmp)
-{
-        return __rsc_match(new, tmp);
-}
-
-static inline void rsc_init(struct rsc *new, struct rsc *tmp)
-{
-        __rsc_init(new, tmp);
-}
-
-static inline void rsc_update(struct rsc *new, struct rsc *tmp)
-{
-        __rsc_update(new, tmp);
-}
-
-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;
-        time_t      expiry;
-        int         status = -EINVAL;
-
-        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 */
-        expiry = get_expiry(&mesg);
-        status = -EINVAL;
-        if (expiry == 0)
-                goto out;
-
-        /* 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 oss 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;
-        }
-
-        /* 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");
-                cfs_set_bit(CACHE_NEGATIVE, &rsci.h.flags);
-        } else {
-                struct gss_api_mech *gm;
-                rawobj_t tmp_buf;
-                unsigned long 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) {
-                        lgss_mech_put(gm);
-                        goto out;
-                }
-                tmp_buf.len = len;
-                tmp_buf.data = (unsigned char *)buf;
-                if (lgss_import_sec_context(&tmp_buf, gm,
-                                            &rsci.ctx.gsc_mechctx)) {
-                        lgss_mech_put(gm);
-                        goto out;
-                }
-
-                /* 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");
-                        lgss_mech_put(gm);
-                        goto out;
-                }
-                expiry = (time_t) ctx_expiry;
-
-                lgss_mech_put(gm);
-        }
-
-        rsci.h.expiry_time = expiry;
-        rscp = rsc_lookup(&rsci, 1);
-        status = 0;
-out:
-        rsc_free(&rsci);
-        if (rscp)
-                rsc_put(&rscp->h, &rsc_cache);
-
-        if (status)
-                CERROR("parse rsc error %d\n", status);
-        return status;
-}
-
-#endif /* HAVE_SUNRPC_CACHE_V2 */
-
-
 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,
 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,
-#ifdef HAVE_SUNRPC_CACHE_V2
         .match          = rsc_match,
         .init           = rsc_init,
         .update         = update_rsc,
         .alloc          = rsc_alloc,
         .match          = rsc_match,
         .init           = rsc_init,
         .update         = update_rsc,
         .alloc          = rsc_alloc,
-#endif
 };
 
 };
 
-#ifdef HAVE_SUNRPC_CACHE_V2
-
 static struct rsc *rsc_lookup(struct rsc *item)
 {
         struct cache_head *ch;
 static struct rsc *rsc_lookup(struct rsc *item)
 {
         struct cache_head *ch;
@@ -968,14 +663,6 @@ static struct rsc *rsc_update(struct rsc *new, struct rsc *old)
 
 #define COMPAT_RSC_PUT(item, cd)        cache_put((item), (cd))
 
 
 #define COMPAT_RSC_PUT(item, cd)        cache_put((item), (cd))
 
-#else
-
-static DefineSimpleCacheLookup(rsc, 0);
-
-#define COMPAT_RSC_PUT(item, cd)        rsc_put((item), (cd))
-
-#endif
-
 /****************************************
  * rsc cache flush                      *
  ****************************************/
 /****************************************
  * rsc cache flush                      *
  ****************************************/
@@ -1052,11 +739,7 @@ static struct rsc *gss_svc_searchbyctx(rawobj_t *handle)
         if (rawobj_dup(&rsci.handle, handle))
                 return NULL;
 
         if (rawobj_dup(&rsci.handle, handle))
                 return NULL;
 
-#ifdef HAVE_SUNRPC_CACHE_V2
         found = rsc_lookup(&rsci);
         found = rsc_lookup(&rsci);
-#else
-        found = rsc_lookup(&rsci, 0);
-#endif
         rsc_free(&rsci);
         if (!found)
                 return NULL;
         rsc_free(&rsci);
         if (!found)
                 return NULL;
@@ -1065,8 +748,6 @@ static struct rsc *gss_svc_searchbyctx(rawobj_t *handle)
         return found;
 }
 
         return found;
 }
 
-#ifdef HAVE_SUNRPC_CACHE_V2
-
 int gss_svc_upcall_install_rvs_ctx(struct obd_import *imp,
                                    struct gss_sec *gsec,
                                    struct gss_cli_ctx *gctx)
 int gss_svc_upcall_install_rvs_ctx(struct obd_import *imp,
                                    struct gss_sec *gsec,
                                    struct gss_cli_ctx *gctx)
@@ -1126,65 +807,6 @@ out:
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-#else /* !HAVE_SUNRPC_CACHE_V2 */
-
-int gss_svc_upcall_install_rvs_ctx(struct obd_import *imp,
-                                   struct gss_sec *gsec,
-                                   struct gss_cli_ctx *gctx)
-{
-        struct rsc      rsci, *rscp;
-        unsigned long   ctx_expiry;
-        __u32           major;
-        int             rc;
-        ENTRY;
-
-        memset(&rsci, 0, sizeof(rsci));
-
-        if (rawobj_alloc(&rsci.handle, (char *) &gsec->gs_rvs_hdl,
-                         sizeof(gsec->gs_rvs_hdl)))
-                GOTO(out, rc = -ENOMEM);
-
-        major = lgss_copy_reverse_context(gctx->gc_mechctx,
-                                          &rsci.ctx.gsc_mechctx);
-        if (major != GSS_S_COMPLETE)
-                GOTO(out, rc = -ENOMEM);
-
-        if (lgss_inquire_context(rsci.ctx.gsc_mechctx, &ctx_expiry)) {
-                CERROR("unable to get expire time, drop it\n");
-                GOTO(out, rc = -ENOMEM);
-        }
-        rsci.h.expiry_time = (time_t) ctx_expiry;
-
-        if (strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0)
-                rsci.ctx.gsc_usr_mds = 1;
-        else if (strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_OSC_NAME) == 0)
-                rsci.ctx.gsc_usr_oss = 1;
-        else
-                rsci.ctx.gsc_usr_root = 1;
-
-        rscp = rsc_lookup(&rsci, 1);
-        if (rscp == NULL) {
-                CERROR("rsc lookup failed\n");
-                GOTO(out, rc = -ENOMEM);
-        }
-
-        rscp->target = imp->imp_obd;
-        rawobj_dup(&gctx->gc_svc_handle, &rscp->handle);
-
-        CWARN("create reverse svc ctx %p to %s: idx "LPX64"\n",
-              &rscp->ctx, obd2cli_tgt(imp->imp_obd), gsec->gs_rvs_hdl);
-        rsc_put(&rscp->h, &rsc_cache);
-        rc = 0;
-out:
-        rsc_free(&rsci);
-        if (rc)
-                CERROR("create reverse svc ctx: idx "LPX64", rc %d\n",
-                       gsec->gs_rvs_hdl, rc);
-        RETURN(rc);
-}
-
-#endif /* HAVE_SUNRPC_CACHE_V2 */
-
 int gss_svc_upcall_expire_rvs_ctx(rawobj_t *handle)
 {
         const cfs_time_t        expire = 20;
 int gss_svc_upcall_expire_rvs_ctx(rawobj_t *handle)
 {
         const cfs_time_t        expire = 20;
@@ -1263,11 +885,7 @@ int gss_svc_upcall_handle_init(struct ptlrpc_request *req,
                 GOTO(out, rc);
         }
 
                 GOTO(out, rc);
         }
 
-#ifdef HAVE_SUNRPC_CACHE_V2
         rsip = rsi_lookup(&rsikey);
         rsip = rsi_lookup(&rsikey);
-#else
-        rsip = rsi_lookup(&rsikey, 0);
-#endif
         rsi_free(&rsikey);
         if (!rsip) {
                 CERROR("error in rsi_lookup.\n");
         rsi_free(&rsikey);
         if (!rsip) {
                 CERROR("error in rsi_lookup.\n");