struct lustre_capa *capa;
int expired = 0;
unsigned long expiry;
+ struct timeval tv;
+
ENTRY;
+ do_gettimeofday(&tv);
spin_lock(&capa_lock);
if (!list_empty(ll_capa_list)) {
ocapa = list_entry(ll_capa_list->next, struct obd_capa, c_list);
- expired = __capa_is_to_expire(ocapa);
+ expired = __capa_is_to_expire(ocapa, &tv);
if (!expired) {
capa = &ocapa->c_capa;
expiry = expiry_to_jiffies(capa->lc_expiry -
int rc;
ENTRY;
- if (capa_expired(&ocapa->c_capa))
- RETURN(-ESTALE);
-
rc = md_getattr(md_exp, &lli->lli_id, valid, NULL, NULL, 0,
0, ocapa, &req);
RETURN(rc);
struct obd_capa *ocapa, tcapa, *tmp, *next = NULL;
unsigned long expiry, sleep = CAPA_PRE_EXPIRY;
struct inode *inode;
+ struct timeval tv;
l_wait_event(capa_thread.t_ctl_waitq,
(have_expired_capa() || ll_capa_check_stop()),
if (ll_capa_check_stop())
break;
+ do_gettimeofday(&tv);
spin_lock(&capa_lock);
list_for_each_entry_safe(ocapa, tmp, ll_capa_list, c_list) {
if (ocapa->c_capa.lc_flags & CAPA_FL_SHORT)
if (ocapa->c_capa.lc_op == CAPA_TRUNC)
continue;
- if (__capa_is_to_expire(ocapa)) {
+ if (capa_expired(&ocapa->c_capa)) {
+ capa_put_nolock(ocapa);
+ continue;
+ }
+
+ if (__capa_is_to_expire(ocapa, &tv)) {
inode = igrab(ocapa->c_inode);
- if (inode == NULL)
+ if (inode == NULL) {
+ DEBUG_CAPA(D_ERROR, &ocapa->c_capa,
+ "igrab failed for");
continue;
+ }
tcapa = *ocapa;
spin_unlock(&capa_lock);
rc = ll_renew_capa(&tcapa);
iput(inode);
- if (rc)
- capa_put(ocapa);
-
spin_lock(&capa_lock);
} else {
next = ocapa;
LASSERT(body != NULL); /* reply already checked out */
LASSERT_REPSWABBED(req, 1); /* and swabbed down */
- if (!(body->valid & OBD_MD_CAPA))
+ if (!(body->valid & OBD_MD_CAPA)) {
+ if (atomic_read(&ll_capa_stat)) {
+ DEBUG_REQ(D_ERROR, req,
+ "no capa for (uid %u, op %d, "DLID4"\n",
+ (unsigned)current->uid, it->it_flags,
+ OLID4(&lli->lli_id));
+ atomic_set(&ll_capa_stat, 0);
+ }
+
return 0;
+ }
ENTRY;
RETURN(ocapa);
}
+
+ if (atomic_read(&ll_capa_stat)) {
+ CDEBUG(D_ERROR, "can't find capa for (uid %u, op %d, mdsid "
+ LPU64", ino %u igen %u) failed.\n",
+ (unsigned)uid, op, id_group(&lli->lli_id),
+ (unsigned)id_ino(&lli->lli_id), id_gen(&lli->lli_id));
+ atomic_set(&ll_capa_stat, 0);
+ }
RETURN(NULL);
}