Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
CORTX-33725: Add lock for m0_rpc_bulk buffer(rbulk) (#2072)
Browse files Browse the repository at this point in the history
rbulk buffer was not protected under lock in ioreq_fop_dgmode_read().
Added lock which was missing earlier.

Signed-off-by: Yatin Mahajan <yatin.mahajan@seagate.com>
  • Loading branch information
yatin-mahajan authored Aug 16, 2022
1 parent d7da706 commit 849b115
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion motr/io_req_fop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 849b115

Please sign in to comment.