mdt_lvb2body may crash if res->lr_lvb_data is
not allocated, make it tolerant to not initialized
lvb_data pointer.
HPE-bug-id: LUS-9549
Signed-off-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Change-Id: Ie31cbba9187f9b04b3d1f8d2abc59e0612a44b41
Reviewed-on: https://review.whamcloud.com/45334
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lock_res(res);
res_lvb = res->lr_lvb_data;
lock_res(res);
res_lvb = res->lr_lvb_data;
- if (lvb)
- *lvb = *res_lvb;
-
- if (mb) {
- mb->mbo_dom_size = res_lvb->lvb_size;
- mb->mbo_dom_blocks = res_lvb->lvb_blocks;
- mb->mbo_mtime = res_lvb->lvb_mtime;
- mb->mbo_ctime = res_lvb->lvb_ctime;
- mb->mbo_atime = res_lvb->lvb_atime;
- mb->mbo_valid |= OBD_MD_FLATIME | OBD_MD_FLCTIME |
- OBD_MD_FLMTIME | OBD_MD_DOM_SIZE;
+ if (res_lvb) {
+ if (lvb)
+ *lvb = *res_lvb;
+
+ if (mb) {
+ mb->mbo_dom_size = res_lvb->lvb_size;
+ mb->mbo_dom_blocks = res_lvb->lvb_blocks;
+ mb->mbo_mtime = res_lvb->lvb_mtime;
+ mb->mbo_ctime = res_lvb->lvb_ctime;
+ mb->mbo_atime = res_lvb->lvb_atime;
+ mb->mbo_valid |= OBD_MD_FLATIME | OBD_MD_FLCTIME |
+ OBD_MD_FLMTIME | OBD_MD_DOM_SIZE;
+ }
+ CDEBUG(D_DLMTRACE, "size %llu\n", res_lvb->lvb_size);
- CDEBUG(D_DLMTRACE, "size %llu\n", res_lvb->lvb_size);
ENTRY;
/* Before going further let's check that OBD and export are healthy.
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");