ENTRY;
/* Before going further let's check that OBD and export are healthy.
+ * The condition matches one in ptlrpc_send_reply()
*/
- if (exp != NULL &&
- (exp->exp_disconnected || exp->exp_failed ||
- exp->exp_obd->obd_stopping)) {
- CDEBUG(D_INFO, "Skip LVB update, export is %s, obd is %s\n",
- exp->exp_failed ? "failed" : "disconnected",
- exp->exp_obd->obd_stopping ? "stopping" : "OK");
+ if (exp && exp->exp_obd && exp->exp_obd->obd_fail) {
+ CDEBUG(D_INFO, "Skip LVB update, obd is failing over\n");
RETURN(0);
}
return qmt_hdls.qmth_lvbo_size(mdt->mdt_qmt_dev, lock);
}
+ /* Always prefer DoM LVB data because layout is never returned in
+ * LVB when lock bits are combined with DoM, this is either GETATTR
+ * or OPEN enqueue. Meanwhile GL AST can be issued on such combined
+ * lock bits and it uses LVB for DoM data.
+ */
if (ldlm_has_dom(lock))
return sizeof(struct ost_lvb);
GOTO(out, rc = -ENOMEM);
}
- /* LVB for DoM lock is needed only for glimpse,
- * don't fill DoM data if there is layout lock */
+ /* DOM LVB is used by glimpse and IO completion when
+ * DoM bits is always alone.
+ * If DoM bit is combined with any other bit then it is
+ * intent OPEN or GETATTR lock which is not filling
+ * LVB buffer in reply neither for DoM nor for LAYOUT.
+ */
if (ldlm_has_dom(lock)) {
struct ldlm_resource *res = lock->l_resource;
int lvb_len = sizeof(struct ost_lvb);
if (!mdt_dom_lvb_is_valid(res))
- mdt_dom_lvbo_update(lock->l_resource, lock, NULL, 0);
-
- if (lvb_len > *lvblen)
- lvb_len = *lvblen;
+ mdt_dom_lvbo_update(res, lock, NULL, 0);
+ LASSERT(*lvblen >= lvb_len);
lock_res(res);
memcpy(lvb, res->lr_lvb_data, lvb_len);
unlock_res(res);
-
GOTO(out, rc = lvb_len);
}
mdt->mdt_max_mdsize = rc;
level = D_INFO;
} else {
- level = D_ERROR;
+ /* The PFL layout EA could be enlarged when
+ * the corresponding layout of some IO range
+ * is started to be written, which can cause
+ * other thread to get incorrect layout size
+ * at mdt_intent_layout, see LU-13261. */
+ level = D_LAYOUT;
}
CDEBUG_LIMIT(level, "%s: small buffer size %d for EA "
"%d (max_mdsize %d): rc = %d\n",