expiry = CUR_CAPA_KEY_JIFFIES(mds);
spin_lock(&mds_capa_lock);
if (time_before(expiry, mds_eck_timer.expires) ||
- !timer_pending(&mds_eck_timer))
+ !timer_pending(&mds_eck_timer)) {
mod_timer(&mds_eck_timer, expiry);
+ CDEBUG(D_INFO, "mds_eck_timer %lu", expiry);
+ }
list_add_capa_key(&CUR_MDS_CAPA_KEY(mds), &mds_capa_key_list);
spin_unlock(&mds_capa_lock);
out:
if (rc2)
GOTO(out, rc2);
- CDEBUG(D_INFO, "wrote capa keyid %u\n", keyid);
-
spin_lock(&mds_capa_lock);
list_del_init(&CUR_CAPA_KEY_LIST(mds));
mds->mds_capa_key_idx = to_update;
list_add_capa_key(&CUR_MDS_CAPA_KEY(mds), &mds_capa_key_list);
if (time_before(expiry, mds_eck_timer.expires) ||
- !timer_pending(&mds_eck_timer))
+ !timer_pending(&mds_eck_timer)) {
mod_timer(&mds_eck_timer, expiry);
+ CDEBUG(D_INFO, "mds_eck_timer %lu\n", expiry);
+ }
spin_unlock(&mds_capa_lock);
DEBUG_MDS_CAPA_KEY(D_INFO, &CUR_MDS_CAPA_KEY(mds),
static inline int have_expired_capa_key(void)
{
struct mds_capa_key *key;
+ unsigned long expiry;
int expired = 0;
ENTRY;
key = list_entry(mds_capa_key_list.next, struct mds_capa_key,
k_list);
/* expiry is in sec, so in case it misses, the result will
- * minus HZ and then compare with jiffies. */
- expired = time_before(CAPA_KEY_JIFFIES(key) - HZ, jiffies);
+ * minus 5 sec and then compare with jiffies. (in case the
+ * clock is innacurate) */
+ expiry = CAPA_KEY_JIFFIES(key);
+ expired = time_before(expiry - 5 * HZ, jiffies);
+ if (!expired) {
+ if (time_before(expiry, mds_eck_timer.expires) ||
+ !timer_pending(&mds_eck_timer)) {
+ mod_timer(&mds_eck_timer, expiry);
+ CDEBUG(D_INFO, "mds_eck_timer %lu", expiry);
+ }
+ }
}
spin_unlock(&mds_capa_lock);
while (!mds_capa_key_check_stop()) {
struct l_wait_info lwi = { 0 };
+ unsigned long expiry;
struct mds_capa_key *key, *tmp, *next = NULL;
l_wait_event(mds_eck_thread.t_ctl_waitq,
spin_lock(&mds_capa_lock);
}
- if (next)
- mod_timer(&mds_eck_timer, CAPA_KEY_JIFFIES(next));
+ if (next) {
+ expiry = CAPA_KEY_JIFFIES(next);
+ mod_timer(&mds_eck_timer, expiry);
+ CDEBUG(D_INFO, "mds_eck_timer %lu", expiry);
+ }
spin_unlock(&mds_capa_lock);
}
mfd = mds_handle2mfd(&req_body->handle);
if (mfd == NULL) {
- DEBUG_CAPA(D_WARNING, req_capa, "no handle "LPX64" for",
+ DEBUG_CAPA(D_INFO, req_capa, "no handle "LPX64" for",
req_body->handle.cookie);
- RETURN(-ESTALE);
+ RETURN(-ENOENT);
}
mode = accmode(mfd->mfd_mode);
mode);
RETURN(-EACCES);
}
+
+ mds_mfd_put(mfd);
}
LASSERT(repmsg->buflens[*offset] == sizeof(*capa));
LASSERT(capa != NULL);
ocapa = capa_get(req_capa->lc_uid, req_capa->lc_op, req_capa->lc_mdsid,
- req_capa->lc_ino, MDS_CAPA);
+ req_capa->lc_ino, req_capa->lc_igen, MDS_CAPA);
if (ocapa) {
expired = capa_is_to_expire(ocapa);
if (!expired) {
capa->lc_keyid = le32_to_cpu(CUR_CAPA_KEY_ID(mds));
capa->lc_expiry = round_expiry(mds->mds_capa_timeout);
if (mds->mds_capa_timeout < CAPA_EXPIRY)
- capa->lc_flags |= CAPA_FL_NOROUND;
+ capa->lc_flags |= CAPA_FL_SHORT;
memcpy(key, CUR_CAPA_KEY(mds)->lk_key, sizeof(key));
spin_unlock(&mds_capa_lock);
- capa_hmac(mds->mds_capa_hmac, key, capa);
+ capa_hmac(key, capa);
ocapa = capa_renew(capa, MDS_CAPA);
if (!ocapa)
rc = -ENOMEM;
+ capa_put(ocapa);
out:
if (rc == 0)
body->valid |= OBD_MD_CAPA;
RETURN(rc);
}
+