Add lock for m0_rpc_bulk buffer(rbulk)
rbulk buffer was not protected under lock in ioreq_fop_dgmode_read().
Added lock which was missing earlier.
@@ -756,6 +756,7 @@ M0_INTERNAL int ioreq_fop_dgmode_read(struct ioreq_fop *irfop)
ioo_nwxfer, &ioo_bobtype);
rbulk = &irfop->irf_iofop.if_rbulk;
+ m0_mutex_lock(&rbulk->rb_mutex);
m0_tl_for (rpcbulk, &rbulk->rb_buflist, rbuf) {
index = rbuf->bb_zerovec.z_index;
@@ -783,10 +784,13 @@ M0_INTERNAL int ioreq_fop_dgmode_read(struct ioreq_fop *irfop)
rc = map->pi_ops->pi_dgmode_process(map,
irfop->irf_tioreq, &index[seg - cnt],
cnt);
- if (rc != 0)
+ if (rc != 0) {
+ m0_mutex_unlock(&rbulk->rb_mutex);
return M0_ERR(rc);
}
+ }
} m0_tl_endfor;
+ m0_mutex_unlock(&rbulk->rb_mutex);
return M0_RC(0);
}
