CERROR("NOENT? set rsc entry negative\n");
set_bit(CACHE_NEGATIVE, &rsci.h.flags);
} else {
- 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)
- 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;
-
- /* 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;
- }
- expiry = (time_t) ctx_expiry;
+ 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,
+ (unsigned long *)&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;
}
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;
+ switch (imp->imp_obd->u.cli.cl_sp_to) {
+ case LUSTRE_SP_MDT:
+ rsci.ctx.gsc_usr_mds = 1;
+ break;
+ case LUSTRE_SP_OST:
+ rsci.ctx.gsc_usr_oss = 1;
+ break;
+ case LUSTRE_SP_CLI:
+ rsci.ctx.gsc_usr_root = 1;
+ default:
+ break;
+ }
rscp = rsc_update(&rsci, rscp);
if (rscp == NULL)
rscp->target = imp->imp_obd;
rawobj_dup(&gctx->gc_svc_handle, &rscp->handle);
- CWARN("create reverse svc ctx %p to %s: idx "LPX64"\n",
+ CWARN("create reverse svc ctx %p to %s: idx %#llx\n",
&rscp->ctx, obd2cli_tgt(imp->imp_obd), gsec->gs_rvs_hdl);
rc = 0;
out:
rsc_free(&rsci);
if (rc)
- CERROR("create reverse svc ctx: idx "LPX64", rc %d\n",
+ CERROR("create reverse svc ctx: idx %#llx, rc %d\n",
gsec->gs_rvs_hdl, rc);
RETURN(rc);
}
switch (rc) {
case -ETIMEDOUT:
case -EAGAIN: {
- int valid;
+ int valid;
- if (first_check) {
- first_check = 0;
+ if (first_check) {
+ first_check = 0;
- read_lock(&rsi_cache.hash_lock);
+ read_lock(&rsi_cache.hash_lock);
valid = test_bit(CACHE_VALID, &rsip->h.flags);
- if (valid == 0)
+ if (valid == 0)
set_current_state(TASK_INTERRUPTIBLE);
- read_unlock(&rsi_cache.hash_lock);
+ read_unlock(&rsi_cache.hash_lock);
if (valid == 0) {
unsigned long jiffies;
}
cache_get(&rsip->h);
goto cache_check;
- }
- CWARN("waited %ds timeout, drop\n", GSS_SVC_UPCALL_TIMEOUT);
- break;
- }
- case -ENOENT:
- CWARN("cache_check return ENOENT, drop\n");
- break;
- case 0:
- /* if not the first check, we have to release the extra
- * reference we just added on it. */
+ }
+ CWARN("waited %ds timeout, drop\n", GSS_SVC_UPCALL_TIMEOUT);
+ break;
+ }
+ case -ENOENT:
+ CDEBUG(D_SEC, "cache_check return ENOENT, drop\n");
+ break;
+ case 0:
+ /* if not the first check, we have to release the extra
+ * reference we just added on it. */
if (!first_check)
cache_put(&rsip->h, &rsi_cache);
CDEBUG(D_SEC, "cache_check is good\n");
if (rc != SECSVC_OK)
set_bit(CACHE_NEGATIVE, &rsci->h.flags);
else
- CDEBUG(D_SEC, "create rsc with idx "LPX64"\n",
+ CDEBUG(D_SEC, "create rsc with idx %#llx\n",
gss_handle_to_u64(&rsci->handle));
COMPAT_RSC_PUT(&rsci->h, &rsc_cache);
rsc = gss_svc_searchbyctx(&gw->gw_handle);
if (!rsc) {
- CWARN("Invalid gss ctx idx "LPX64" from %s\n",
+ CWARN("Invalid gss ctx idx %#llx from %s\n",
gss_handle_to_u64(&gw->gw_handle),
libcfs_nid2str(req->rq_peer.nid));
return NULL;