static int mdt_enqueue(struct mdt_thread_info *info)
{
struct ptlrpc_request *req;
- __u64 req_bits;
int rc;
/*
LASSERT(info->mti_dlm_req != NULL);
req = mdt_info_req(info);
-
- /*
- * Lock without inodebits makes no sense and will oops later in
- * ldlm. Let's check it now to see if we have wrong lock from client or
- * bits get corrupted somewhere in mdt_intent_policy().
- */
- req_bits = info->mti_dlm_req->lock_desc.l_policy_data.l_inodebits.bits;
- /* This is disabled because we need to support liblustre flock.
- * LASSERT(req_bits != 0);
- */
-
rc = ldlm_handle_enqueue0(info->mti_mdt->mdt_namespace,
req, info->mti_dlm_req, &cbs);
info->mti_fail_id = OBD_FAIL_LDLM_REPLY;
dlm_req = req_capsule_client_get(info->mti_pill, &RMF_DLM_REQ);
if (dlm_req != NULL) {
- if (info->mti_mdt->mdt_opts.mo_compat_resname)
- rc = mdt_lock_resname_compat(info->mti_mdt,
- dlm_req);
- info->mti_dlm_req = dlm_req;
+ if (unlikely(dlm_req->lock_desc.l_resource.lr_type ==
+ LDLM_IBITS &&
+ dlm_req->lock_desc.l_policy_data.\
+ l_inodebits.bits == 0)) {
+ /*
+ * Lock without inodebits makes no sense and
+ * will oops later in ldlm. If client miss to
+ * set such bits, do not trigger ASSERTION.
+ *
+ * For liblustre flock case, it maybe zero.
+ */
+ rc = -EPROTO;
+ } else {
+ if (info->mti_mdt->mdt_opts.mo_compat_resname)
+ rc = mdt_lock_resname_compat(
+ info->mti_mdt,
+ dlm_req);
+ info->mti_dlm_req = dlm_req;
+ }
} else {
rc = -EFAULT;
}
req_capsule_extend(pill, &RQF_LDLM_INTENT);
it = req_capsule_client_get(pill, &RMF_LDLM_INTENT);
if (it != NULL) {
- const struct ldlm_request *dlmreq;
- __u64 req_bits;
-
rc = mdt_intent_opc(it->opc, info, lockp, flags);
if (rc == 0)
rc = ELDLM_OK;
- /*
- * Lock without inodebits makes no sense and will oops
+ /* Lock without inodebits makes no sense and will oops
* later in ldlm. Let's check it now to see if we have
- * wrong lock from client or bits get corrupted
- * somewhere in mdt_intent_opc().
- */
- dlmreq = info->mti_dlm_req;
- req_bits = dlmreq->lock_desc.l_policy_data.l_inodebits.bits;
- LASSERT(req_bits != 0);
-
+ * ibits corrupted somewhere in mdt_intent_opc().
+ * The case for client miss to set ibits has been
+ * processed by others. */
+ LASSERT(ergo(info->mti_dlm_req->lock_desc.l_resource.\
+ lr_type == LDLM_IBITS,
+ info->mti_dlm_req->lock_desc.\
+ l_policy_data.l_inodebits.bits != 0));
} else
rc = err_serious(-EFAULT);
} else {
ENTRY;
LASSERT(!lustre_handle_is_used(lh));
- LASSERT((oa->o_valid & (OBD_MD_FLID | OBD_MD_FLGROUP)) ==
- (OBD_MD_FLID | OBD_MD_FLGROUP));
+ /* o_id and o_gr are used for localizing resource, if client miss to set
+ * them, do not trigger ASSERTION. */
+ if (unlikely((oa->o_valid & (OBD_MD_FLID | OBD_MD_FLGROUP)) !=
+ (OBD_MD_FLID | OBD_MD_FLGROUP)))
+ RETURN(-EPROTO);
if (!(oa->o_valid & OBD_MD_FLFLAGS) ||
!(oa->o_flags & OBD_FL_SRVLOCK))