These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / lustre / lustre / ptlrpc / sec.c
index 21e9dc9..39f5261 100644 (file)
@@ -113,10 +113,10 @@ static
 struct ptlrpc_sec_policy *sptlrpc_wireflavor2policy(__u32 flavor)
 {
        static DEFINE_MUTEX(load_mutex);
-       static atomic_t       loaded = ATOMIC_INIT(0);
+       static atomic_t loaded = ATOMIC_INIT(0);
        struct ptlrpc_sec_policy *policy;
-       __u16                number = SPTLRPC_FLVR_POLICY(flavor);
-       __u16                flag = 0;
+       __u16 number = SPTLRPC_FLVR_POLICY(flavor);
+       __u16 flag = 0;
 
        if (number >= SPTLRPC_POLICY_MAX)
                return NULL;
@@ -227,7 +227,7 @@ char *sptlrpc_flavor2name(struct sptlrpc_flavor *sf, char *buf, int bufsize)
 }
 EXPORT_SYMBOL(sptlrpc_flavor2name);
 
-char *sptlrpc_secflags2str(__u32 flags, char *buf, int bufsize)
+static char *sptlrpc_secflags2str(__u32 flags, char *buf, int bufsize)
 {
        buf[0] = '\0';
 
@@ -244,7 +244,6 @@ char *sptlrpc_secflags2str(__u32 flags, char *buf, int bufsize)
 
        return buf;
 }
-EXPORT_SYMBOL(sptlrpc_secflags2str);
 
 /**************************************************
  * client context APIs                     *
@@ -297,53 +296,13 @@ void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int sync)
 }
 EXPORT_SYMBOL(sptlrpc_cli_ctx_put);
 
-/**
- * Expire the client context immediately.
- *
- * \pre Caller must hold at least 1 reference on the \a ctx.
- */
-void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx)
-{
-       LASSERT(ctx->cc_ops->force_die);
-       ctx->cc_ops->force_die(ctx, 0);
-}
-EXPORT_SYMBOL(sptlrpc_cli_ctx_expire);
-
-/**
- * To wake up the threads who are waiting for this client context. Called
- * after some status change happened on \a ctx.
- */
-void sptlrpc_cli_ctx_wakeup(struct ptlrpc_cli_ctx *ctx)
-{
-       struct ptlrpc_request *req, *next;
-
-       spin_lock(&ctx->cc_lock);
-       list_for_each_entry_safe(req, next, &ctx->cc_req_list,
-                                    rq_ctx_chain) {
-               list_del_init(&req->rq_ctx_chain);
-               ptlrpc_client_wake_req(req);
-       }
-       spin_unlock(&ctx->cc_lock);
-}
-EXPORT_SYMBOL(sptlrpc_cli_ctx_wakeup);
-
-int sptlrpc_cli_ctx_display(struct ptlrpc_cli_ctx *ctx, char *buf, int bufsize)
-{
-       LASSERT(ctx->cc_ops);
-
-       if (ctx->cc_ops->display == NULL)
-               return 0;
-
-       return ctx->cc_ops->display(ctx, buf, bufsize);
-}
-
 static int import_sec_check_expire(struct obd_import *imp)
 {
-       int     adapt = 0;
+       int adapt = 0;
 
        spin_lock(&imp->imp_lock);
        if (imp->imp_sec_expire &&
-           imp->imp_sec_expire < get_seconds()) {
+           imp->imp_sec_expire < ktime_get_real_seconds()) {
                adapt = 1;
                imp->imp_sec_expire = 0;
        }
@@ -359,7 +318,7 @@ static int import_sec_check_expire(struct obd_import *imp)
 static int import_sec_validate_get(struct obd_import *imp,
                                   struct ptlrpc_sec **sec)
 {
-       int     rc;
+       int rc;
 
        if (unlikely(imp->imp_sec_expire)) {
                rc = import_sec_check_expire(imp);
@@ -447,10 +406,10 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req,
                           struct ptlrpc_cli_ctx *oldctx,
                           struct ptlrpc_cli_ctx *newctx)
 {
-       struct sptlrpc_flavor   old_flvr;
-       char               *reqmsg = NULL; /* to workaround old gcc */
-       int                  reqmsg_size;
-       int                  rc = 0;
+       struct sptlrpc_flavor old_flvr;
+       char *reqmsg = NULL; /* to workaround old gcc */
+       int reqmsg_size;
+       int rc = 0;
 
        LASSERT(req->rq_reqmsg);
        LASSERT(req->rq_reqlen);
@@ -469,7 +428,7 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req,
        /* save request message */
        reqmsg_size = req->rq_reqlen;
        if (reqmsg_size != 0) {
-               OBD_ALLOC_LARGE(reqmsg, reqmsg_size);
+               reqmsg = libcfs_kvzalloc(reqmsg_size, GFP_NOFS);
                if (reqmsg == NULL)
                        return -ENOMEM;
                memcpy(reqmsg, req->rq_reqmsg, reqmsg_size);
@@ -497,7 +456,7 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req,
                        req->rq_flvr = old_flvr;
                }
 
-               OBD_FREE_LARGE(reqmsg, reqmsg_size);
+               kvfree(reqmsg);
        }
        return rc;
 }
@@ -510,11 +469,11 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req,
  * \note a request must have a context, to keep other parts of code happy.
  * In any case of failure during the switching, we must restore the old one.
  */
-int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req)
+static int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req)
 {
        struct ptlrpc_cli_ctx *oldctx = req->rq_cli_ctx;
        struct ptlrpc_cli_ctx *newctx;
-       int                 rc;
+       int rc;
 
        LASSERT(oldctx);
 
@@ -563,7 +522,6 @@ int sptlrpc_req_replace_dead_ctx(struct ptlrpc_request *req)
        sptlrpc_cli_ctx_put(oldctx, 1);
        return 0;
 }
-EXPORT_SYMBOL(sptlrpc_req_replace_dead_ctx);
 
 static
 int ctx_check_refresh(struct ptlrpc_cli_ctx *ctx)
@@ -629,10 +587,10 @@ void req_off_ctx_list(struct ptlrpc_request *req, struct ptlrpc_cli_ctx *ctx)
  */
 int sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout)
 {
-       struct ptlrpc_cli_ctx  *ctx = req->rq_cli_ctx;
-       struct ptlrpc_sec      *sec;
-       struct l_wait_info      lwi;
-       int                  rc;
+       struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
+       struct ptlrpc_sec *sec;
+       struct l_wait_info lwi;
+       int rc;
 
        LASSERT(ctx);
 
@@ -866,7 +824,7 @@ void sptlrpc_request_out_callback(struct ptlrpc_request *req)
        if (req->rq_pool || !req->rq_reqbuf)
                return;
 
-       OBD_FREE(req->rq_reqbuf, req->rq_reqbuf_len);
+       kfree(req->rq_reqbuf);
        req->rq_reqbuf = NULL;
        req->rq_reqbuf_len = 0;
 }
@@ -878,7 +836,7 @@ void sptlrpc_request_out_callback(struct ptlrpc_request *req)
  */
 int sptlrpc_import_check_ctx(struct obd_import *imp)
 {
-       struct ptlrpc_sec     *sec;
+       struct ptlrpc_sec *sec;
        struct ptlrpc_cli_ctx *ctx;
        struct ptlrpc_request *req = NULL;
        int rc;
@@ -974,7 +932,7 @@ int sptlrpc_cli_wrap_request(struct ptlrpc_request *req)
 static int do_cli_unwrap_reply(struct ptlrpc_request *req)
 {
        struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
-       int                 rc;
+       int rc;
 
        LASSERT(ctx);
        LASSERT(ctx->cc_sec);
@@ -1082,10 +1040,10 @@ int sptlrpc_cli_unwrap_reply(struct ptlrpc_request *req)
 int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req,
                                   struct ptlrpc_request **req_ret)
 {
-       struct ptlrpc_request  *early_req;
-       char               *early_buf;
-       int                  early_bufsz, early_size;
-       int                  rc;
+       struct ptlrpc_request *early_req;
+       char *early_buf;
+       int early_bufsz, early_size;
+       int rc;
 
        early_req = ptlrpc_request_cache_alloc(GFP_NOFS);
        if (early_req == NULL)
@@ -1093,7 +1051,7 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req,
 
        early_size = req->rq_nob_received;
        early_bufsz = size_roundup_power2(early_size);
-       OBD_ALLOC_LARGE(early_buf, early_bufsz);
+       early_buf = libcfs_kvzalloc(early_bufsz, GFP_NOFS);
        if (early_buf == NULL) {
                rc = -ENOMEM;
                goto err_req;
@@ -1163,7 +1121,7 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req,
 err_ctx:
        sptlrpc_cli_ctx_put(early_req->rq_cli_ctx, 1);
 err_buf:
-       OBD_FREE_LARGE(early_buf, early_bufsz);
+       kvfree(early_buf);
 err_req:
        ptlrpc_request_cache_free(early_req);
        return rc;
@@ -1181,7 +1139,7 @@ void sptlrpc_cli_finish_early_reply(struct ptlrpc_request *early_req)
        LASSERT(early_req->rq_repmsg);
 
        sptlrpc_cli_ctx_put(early_req->rq_cli_ctx, 1);
-       OBD_FREE_LARGE(early_req->rq_repbuf, early_req->rq_repbuf_len);
+       kvfree(early_req->rq_repbuf);
        ptlrpc_request_cache_free(early_req);
 }
 
@@ -1229,12 +1187,6 @@ static void sec_cop_destroy_sec(struct ptlrpc_sec *sec)
        sptlrpc_policy_put(policy);
 }
 
-void sptlrpc_sec_destroy(struct ptlrpc_sec *sec)
-{
-       sec_cop_destroy_sec(sec);
-}
-EXPORT_SYMBOL(sptlrpc_sec_destroy);
-
 static void sptlrpc_sec_kill(struct ptlrpc_sec *sec)
 {
        LASSERT_ATOMIC_POS(&sec->ps_refcount);
@@ -1246,14 +1198,13 @@ static void sptlrpc_sec_kill(struct ptlrpc_sec *sec)
        }
 }
 
-struct ptlrpc_sec *sptlrpc_sec_get(struct ptlrpc_sec *sec)
+static struct ptlrpc_sec *sptlrpc_sec_get(struct ptlrpc_sec *sec)
 {
        if (sec)
                atomic_inc(&sec->ps_refcount);
 
        return sec;
 }
-EXPORT_SYMBOL(sptlrpc_sec_get);
 
 void sptlrpc_sec_put(struct ptlrpc_sec *sec)
 {
@@ -1273,13 +1224,13 @@ EXPORT_SYMBOL(sptlrpc_sec_put);
  */
 static
 struct ptlrpc_sec *sptlrpc_sec_create(struct obd_import *imp,
-                                      struct ptlrpc_svc_ctx *svc_ctx,
-                                      struct sptlrpc_flavor *sf,
-                                      enum lustre_sec_part sp)
+                                     struct ptlrpc_svc_ctx *svc_ctx,
+                                     struct sptlrpc_flavor *sf,
+                                     enum lustre_sec_part sp)
 {
        struct ptlrpc_sec_policy *policy;
-       struct ptlrpc_sec       *sec;
-       char                  str[32];
+       struct ptlrpc_sec *sec;
+       char str[32];
 
        if (svc_ctx) {
                LASSERT(imp->imp_dlm_fake == 1);
@@ -1369,7 +1320,7 @@ static void sptlrpc_import_sec_adapt_inplace(struct obd_import *imp,
                                             struct ptlrpc_sec *sec,
                                             struct sptlrpc_flavor *sf)
 {
-       char    str1[32], str2[32];
+       char str1[32], str2[32];
 
        if (sec->ps_flvr.sf_flags != sf->sf_flags)
                CDEBUG(D_SEC, "changing sec flags: %s -> %s\n",
@@ -1394,12 +1345,12 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp,
                             struct ptlrpc_svc_ctx *svc_ctx,
                             struct sptlrpc_flavor *flvr)
 {
-       struct ptlrpc_connection   *conn;
-       struct sptlrpc_flavor       sf;
-       struct ptlrpc_sec         *sec, *newsec;
-       enum lustre_sec_part    sp;
-       char                    str[24];
-       int                      rc = 0;
+       struct ptlrpc_connection *conn;
+       struct sptlrpc_flavor sf;
+       struct ptlrpc_sec *sec, *newsec;
+       enum lustre_sec_part sp;
+       char str[24];
+       int rc = 0;
 
        might_sleep();
 
@@ -1436,7 +1387,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp,
 
        sec = sptlrpc_import_sec_ref(imp);
        if (sec) {
-               char    str2[24];
+               char str2[24];
 
                if (flavor_equal(&sf, &sec->ps_flvr))
                        goto out;
@@ -1507,13 +1458,6 @@ static void import_flush_ctx_common(struct obd_import *imp,
        sptlrpc_sec_put(sec);
 }
 
-void sptlrpc_import_flush_root_ctx(struct obd_import *imp)
-{
-       /* it's important to use grace mode, see explain in
-        * sptlrpc_req_refresh_ctx() */
-       import_flush_ctx_common(imp, 0, 1, 1);
-}
-
 void sptlrpc_import_flush_my_ctx(struct obd_import *imp)
 {
        import_flush_ctx_common(imp, from_kuid(&init_user_ns, current_uid()),
@@ -1585,8 +1529,8 @@ void sptlrpc_cli_free_reqbuf(struct ptlrpc_request *req)
 void _sptlrpc_enlarge_msg_inplace(struct lustre_msg *msg,
                                  int segment, int newsize)
 {
-       void   *src, *dst;
-       int     oldsize, oldmsg_size, movesize;
+       void *src, *dst;
+       int oldsize, oldmsg_size, movesize;
 
        LASSERT(segment < msg->lm_bufcount);
        LASSERT(msg->lm_buflens[segment] <= newsize);
@@ -1635,9 +1579,9 @@ EXPORT_SYMBOL(_sptlrpc_enlarge_msg_inplace);
 int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req,
                               int segment, int newsize)
 {
-       struct ptlrpc_cli_ctx    *ctx = req->rq_cli_ctx;
-       struct ptlrpc_sec_cops   *cops;
-       struct lustre_msg       *msg = req->rq_reqmsg;
+       struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;
+       struct ptlrpc_sec_cops *cops;
+       struct lustre_msg *msg = req->rq_reqmsg;
 
        LASSERT(ctx);
        LASSERT(msg);
@@ -1697,18 +1641,8 @@ void sptlrpc_cli_free_repbuf(struct ptlrpc_request *req)
        req->rq_repmsg = NULL;
 }
 
-int sptlrpc_cli_install_rvs_ctx(struct obd_import *imp,
-                               struct ptlrpc_cli_ctx *ctx)
-{
-       struct ptlrpc_sec_policy *policy = ctx->cc_sec->ps_policy;
-
-       if (!policy->sp_cops->install_rctx)
-               return 0;
-       return policy->sp_cops->install_rctx(imp, ctx->cc_sec, ctx);
-}
-
-int sptlrpc_svc_install_rvs_ctx(struct obd_import *imp,
-                               struct ptlrpc_svc_ctx *ctx)
+static int sptlrpc_svc_install_rvs_ctx(struct obd_import *imp,
+                                      struct ptlrpc_svc_ctx *ctx)
 {
        struct ptlrpc_sec_policy *policy = ctx->sc_policy;
 
@@ -1748,7 +1682,7 @@ static int flavor_allowed(struct sptlrpc_flavor *exp,
 int sptlrpc_target_export_check(struct obd_export *exp,
                                struct ptlrpc_request *req)
 {
-       struct sptlrpc_flavor   flavor;
+       struct sptlrpc_flavor flavor;
 
        if (exp == NULL)
                return 0;
@@ -1779,7 +1713,7 @@ int sptlrpc_target_export_check(struct obd_export *exp,
                exp->exp_flvr_old[1] = exp->exp_flvr_old[0];
                exp->exp_flvr_expire[1] = exp->exp_flvr_expire[0];
                exp->exp_flvr_old[0] = exp->exp_flvr;
-               exp->exp_flvr_expire[0] = get_seconds() +
+               exp->exp_flvr_expire[0] = ktime_get_real_seconds() +
                                          EXP_FLVR_UPDATE_EXPIRE;
                exp->exp_flvr = flavor;
 
@@ -1853,14 +1787,14 @@ int sptlrpc_target_export_check(struct obd_export *exp,
        }
 
        if (exp->exp_flvr_expire[0]) {
-               if (exp->exp_flvr_expire[0] >= get_seconds()) {
+               if (exp->exp_flvr_expire[0] >= ktime_get_real_seconds()) {
                        if (flavor_allowed(&exp->exp_flvr_old[0], req)) {
-                               CDEBUG(D_SEC, "exp %p (%x|%x|%x): match the middle one (" CFS_DURATION_T ")\n", exp,
+                               CDEBUG(D_SEC, "exp %p (%x|%x|%x): match the middle one (%lld)\n", exp,
                                       exp->exp_flvr.sf_rpc,
                                       exp->exp_flvr_old[0].sf_rpc,
                                       exp->exp_flvr_old[1].sf_rpc,
-                                      exp->exp_flvr_expire[0] -
-                                      get_seconds());
+                                      (s64)(exp->exp_flvr_expire[0] -
+                                      ktime_get_real_seconds()));
                                spin_unlock(&exp->exp_lock);
                                return 0;
                        }
@@ -1877,15 +1811,15 @@ int sptlrpc_target_export_check(struct obd_export *exp,
        /* now it doesn't match the current flavor, the only chance we can
         * accept it is match the old flavors which is not expired. */
        if (exp->exp_flvr_changed == 0 && exp->exp_flvr_expire[1]) {
-               if (exp->exp_flvr_expire[1] >= get_seconds()) {
+               if (exp->exp_flvr_expire[1] >= ktime_get_real_seconds()) {
                        if (flavor_allowed(&exp->exp_flvr_old[1], req)) {
-                               CDEBUG(D_SEC, "exp %p (%x|%x|%x): match the oldest one (" CFS_DURATION_T ")\n",
+                               CDEBUG(D_SEC, "exp %p (%x|%x|%x): match the oldest one (%lld)\n",
                                       exp,
                                       exp->exp_flvr.sf_rpc,
                                       exp->exp_flvr_old[0].sf_rpc,
                                       exp->exp_flvr_old[1].sf_rpc,
-                                      exp->exp_flvr_expire[1] -
-                                      get_seconds());
+                                      (s64)(exp->exp_flvr_expire[1] -
+                                      ktime_get_real_seconds()));
                                spin_unlock(&exp->exp_lock);
                                return 0;
                        }
@@ -1905,7 +1839,7 @@ int sptlrpc_target_export_check(struct obd_export *exp,
 
        spin_unlock(&exp->exp_lock);
 
-       CWARN("exp %p(%s): req %p (%u|%u|%u|%u|%u|%u) with unauthorized flavor %x, expect %x|%x(%+ld)|%x(%+ld)\n",
+       CWARN("exp %p(%s): req %p (%u|%u|%u|%u|%u|%u) with unauthorized flavor %x, expect %x|%x(%+lld)|%x(%+lld)\n",
              exp, exp->exp_obd->obd_name,
              req, req->rq_auth_gss, req->rq_ctx_init, req->rq_ctx_fini,
              req->rq_auth_usr_root, req->rq_auth_usr_mdt, req->rq_auth_usr_ost,
@@ -1913,56 +1847,14 @@ int sptlrpc_target_export_check(struct obd_export *exp,
              exp->exp_flvr.sf_rpc,
              exp->exp_flvr_old[0].sf_rpc,
              exp->exp_flvr_expire[0] ?
-             (unsigned long) (exp->exp_flvr_expire[0] -
-                              get_seconds()) : 0,
+             (s64)(exp->exp_flvr_expire[0] - ktime_get_real_seconds()) : 0,
              exp->exp_flvr_old[1].sf_rpc,
              exp->exp_flvr_expire[1] ?
-             (unsigned long) (exp->exp_flvr_expire[1] -
-                              get_seconds()) : 0);
+             (s64)(exp->exp_flvr_expire[1] - ktime_get_real_seconds()) : 0);
        return -EACCES;
 }
 EXPORT_SYMBOL(sptlrpc_target_export_check);
 
-void sptlrpc_target_update_exp_flavor(struct obd_device *obd,
-                                     struct sptlrpc_rule_set *rset)
-{
-       struct obd_export       *exp;
-       struct sptlrpc_flavor    new_flvr;
-
-       LASSERT(obd);
-
-       spin_lock(&obd->obd_dev_lock);
-
-       list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) {
-               if (exp->exp_connection == NULL)
-                       continue;
-
-               /* note if this export had just been updated flavor
-                * (exp_flvr_changed == 1), this will override the
-                * previous one. */
-               spin_lock(&exp->exp_lock);
-               sptlrpc_target_choose_flavor(rset, exp->exp_sp_peer,
-                                            exp->exp_connection->c_peer.nid,
-                                            &new_flvr);
-               if (exp->exp_flvr_changed ||
-                   !flavor_equal(&new_flvr, &exp->exp_flvr)) {
-                       exp->exp_flvr_old[1] = new_flvr;
-                       exp->exp_flvr_expire[1] = 0;
-                       exp->exp_flvr_changed = 1;
-                       exp->exp_flvr_adapt = 1;
-
-                       CDEBUG(D_SEC, "exp %p (%s): updated flavor %x->%x\n",
-                              exp, sptlrpc_part2name(exp->exp_sp_peer),
-                              exp->exp_flvr.sf_rpc,
-                              exp->exp_flvr_old[1].sf_rpc);
-               }
-               spin_unlock(&exp->exp_lock);
-       }
-
-       spin_unlock(&obd->obd_dev_lock);
-}
-EXPORT_SYMBOL(sptlrpc_target_update_exp_flavor);
-
 static int sptlrpc_svc_check_from(struct ptlrpc_request *req, int svc_rc)
 {
        /* peer's claim is unreliable unless gss is being used */
@@ -2019,8 +1911,8 @@ static int sptlrpc_svc_check_from(struct ptlrpc_request *req, int svc_rc)
 int sptlrpc_svc_unwrap_request(struct ptlrpc_request *req)
 {
        struct ptlrpc_sec_policy *policy;
-       struct lustre_msg       *msg = req->rq_reqbuf;
-       int                    rc;
+       struct lustre_msg *msg = req->rq_reqbuf;
+       int rc;
 
        LASSERT(msg);
        LASSERT(req->rq_reqmsg == NULL);
@@ -2090,6 +1982,7 @@ int sptlrpc_svc_alloc_rs(struct ptlrpc_request *req, int msglen)
        rc = policy->sp_sops->alloc_rs(req, msglen);
        if (unlikely(rc == -ENOMEM)) {
                struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
+
                if (svcpt->scp_service->srv_max_reply_size <
                   msglen + sizeof(struct ptlrpc_reply_state)) {
                        /* Just return failure if the size is too big */
@@ -2185,19 +2078,6 @@ void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req)
        req->rq_svc_ctx = NULL;
 }
 
-void sptlrpc_svc_ctx_invalidate(struct ptlrpc_request *req)
-{
-       struct ptlrpc_svc_ctx *ctx = req->rq_svc_ctx;
-
-       if (ctx == NULL)
-               return;
-
-       LASSERT_ATOMIC_POS(&ctx->sc_refcount);
-       if (ctx->sc_policy->sp_sops->invalidate_ctx)
-               ctx->sc_policy->sp_sops->invalidate_ctx(ctx);
-}
-EXPORT_SYMBOL(sptlrpc_svc_ctx_invalidate);
-
 /****************************************
  * bulk security                       *
  ****************************************/
@@ -2231,8 +2111,8 @@ int sptlrpc_cli_unwrap_bulk_read(struct ptlrpc_request *req,
                                 struct ptlrpc_bulk_desc *desc,
                                 int nob)
 {
-       struct ptlrpc_cli_ctx  *ctx;
-       int                  rc;
+       struct ptlrpc_cli_ctx *ctx;
+       int rc;
 
        LASSERT(req->rq_bulk_read && !req->rq_bulk_write);
 
@@ -2256,8 +2136,8 @@ EXPORT_SYMBOL(sptlrpc_cli_unwrap_bulk_read);
 int sptlrpc_cli_unwrap_bulk_write(struct ptlrpc_request *req,
                                  struct ptlrpc_bulk_desc *desc)
 {
-       struct ptlrpc_cli_ctx  *ctx;
-       int                  rc;
+       struct ptlrpc_cli_ctx *ctx;
+       int rc;
 
        LASSERT(!req->rq_bulk_read && req->rq_bulk_write);
 
@@ -2285,7 +2165,6 @@ int sptlrpc_cli_unwrap_bulk_write(struct ptlrpc_request *req,
 }
 EXPORT_SYMBOL(sptlrpc_cli_unwrap_bulk_write);
 
-
 /****************************************
  * user descriptor helpers           *
  ****************************************/
@@ -2329,7 +2208,7 @@ EXPORT_SYMBOL(sptlrpc_pack_user_desc);
 int sptlrpc_unpack_user_desc(struct lustre_msg *msg, int offset, int swabbed)
 {
        struct ptlrpc_user_desc *pud;
-       int                   i;
+       int i;
 
        pud = lustre_msg_buf(msg, offset, sizeof(*pud));
        if (!pud)
@@ -2382,14 +2261,14 @@ EXPORT_SYMBOL(sec2target_str);
 /*
  * return true if the bulk data is protected
  */
-int sptlrpc_flavor_has_bulk(struct sptlrpc_flavor *flvr)
+bool sptlrpc_flavor_has_bulk(struct sptlrpc_flavor *flvr)
 {
        switch (SPTLRPC_FLVR_BULK_SVC(flvr->sf_rpc)) {
        case SPTLRPC_BULK_SVC_INTG:
        case SPTLRPC_BULK_SVC_PRIV:
-               return 1;
+               return true;
        default:
-               return 0;
+               return false;
        }
 }
 EXPORT_SYMBOL(sptlrpc_flavor_has_bulk);