Whamcloud - gitweb
LU-13498 gss: update sequence in case of target disconnect
[fs/lustre-release.git] / lustre / ptlrpc / sec.c
index 9c53ebe..093a1a3 100644 (file)
@@ -700,8 +700,8 @@ again:
                RETURN(0);
 
        if (unlikely(test_bit(PTLRPC_CTX_NEW_BIT, &ctx->cc_flags))) {
-               LASSERT(ctx->cc_ops->refresh);
-               ctx->cc_ops->refresh(ctx);
+               if (ctx->cc_ops->refresh)
+                       ctx->cc_ops->refresh(ctx);
        }
        LASSERT(test_bit(PTLRPC_CTX_NEW_BIT, &ctx->cc_flags) == 0);
 
@@ -831,6 +831,29 @@ again:
        goto again;
 }
 
+/* Bring ptlrpc_sec context up-to-date */
+int sptlrpc_export_update_ctx(struct obd_export *exp)
+{
+       struct obd_import *imp = exp ? exp->exp_imp_reverse : NULL;
+       struct ptlrpc_sec *sec = NULL;
+       struct ptlrpc_cli_ctx *ctx = NULL;
+       int rc = 0;
+
+       if (imp)
+               sec = sptlrpc_import_sec_ref(imp);
+       if (sec) {
+               ctx = get_my_ctx(sec);
+               sptlrpc_sec_put(sec);
+       }
+
+       if (ctx) {
+               if (ctx->cc_ops->refresh)
+                       rc = ctx->cc_ops->refresh(ctx);
+               sptlrpc_cli_ctx_put(ctx, 1);
+       }
+       return rc;
+}
+
 /**
  * Initialize flavor settings for \a req, according to \a opcode.
  *