/** cancellation is pending for this lock. */
CLF_CANCELPEND = 1 << 1,
/** destruction is pending for this lock. */
- CLF_DOOMED = 1 << 2
+ CLF_DOOMED = 1 << 2,
+ /** from enqueue RPC reply upcall. */
+ CLF_FROM_UPCALL= 1 << 3,
};
/**
*/
CEF_AGL = 0x00000020,
/**
- * do not trigger re-enqueue.
- */
- CEF_NO_REENQUEUE = 0x00000040,
- /**
* mask of enq_flags.
*/
- CEF_MASK = 0x0000007f,
+ CEF_MASK = 0x0000003f,
};
/**
if (lls->sub_flags & LSF_HELD) {
LASSERT(sublock->cll_state == CLS_HELD ||
sublock->cll_state == CLS_ENQUEUED);
- /* For AGL case, the sublock state maybe not
- * match the lower layer state, so sync them
- * before unuse. */
- if (sublock->cll_users == 1 &&
- sublock->cll_state == CLS_ENQUEUED) {
- __u32 save;
-
- save = sublock->cll_descr.cld_enq_flags;
- sublock->cll_descr.cld_enq_flags |=
- CEF_NO_REENQUEUE;
- cl_wait_try(env, sublock);
- sublock->cll_descr.cld_enq_flags = save;
- }
rc = cl_unuse_try(subenv->lse_env, sublock);
rc = lov_sublock_release(env, lck, i, 0, rc);
}
LDLM_LOCK_PUT(dlmlock);
}
} else {
- if (olck->ols_glimpse) {
+ if (olck->ols_glimpse)
olck->ols_glimpse = 0;
- olck->ols_agl = 0 ;
- }
osc_lock_upcall0(env, olck);
}
}
if (rc == 0) {
+ /* For AGL case, the RPC sponsor may exits the cl_lock
+ * processing without wait() called before related OSC
+ * lock upcall(). So update the lock status according
+ * to the enqueue result inside AGL upcall(). */
+ if (olck->ols_agl) {
+ lock->cll_flags |= CLF_FROM_UPCALL;
+ cl_wait_try(env, lock);
+ lock->cll_flags &= ~CLF_FROM_UPCALL;
+ if (!olck->ols_glimpse)
+ olck->ols_agl = 0;
+ }
cl_lock_signal(env, lock);
/* del user for lock upcall cookie */
cl_unuse_try(env, lock);
if (olck->ols_flags & LDLM_FL_LVB_READY) {
return 0;
} else if (olck->ols_agl) {
- olck->ols_state = OLS_NEW;
+ if (lock->cll_flags & CLF_FROM_UPCALL)
+ /* It is from enqueue RPC reply upcall for
+ * updating state. Do not re-enqueue. */
+ return -ENAVAIL;
+ else
+ olck->ols_state = OLS_NEW;
} else {
LASSERT(lock->cll_error);
return lock->cll_error;
}
if (olck->ols_state == OLS_NEW) {
- if (lock->cll_descr.cld_enq_flags & CEF_NO_REENQUEUE) {
- return -ENAVAIL;
- } else {
- int rc;
+ int rc;
- LASSERT(olck->ols_agl);
+ LASSERT(olck->ols_agl);
- rc = osc_lock_enqueue(env, slice, NULL, CEF_ASYNC |
- CEF_MUST);
- if (rc != 0)
- return rc;
- else
- return CLO_REENQUEUED;
- }
+ rc = osc_lock_enqueue(env, slice, NULL, CEF_ASYNC | CEF_MUST);
+ if (rc != 0)
+ return rc;
+ else
+ return CLO_REENQUEUED;
}
LASSERT(equi(olck->ols_state >= OLS_UPCALL_RECEIVED &&