bdev/compress: fix issue with freeing mbufs in compress error path
mbufs are freed with a single call to the first mbuf in the chain unless we hit an error before we chain them. So free them correctly when chained and loop through the array one at a time and free them that way if not. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: I80ebb86bc2147b42db89d24f8e985cacf7d4bceb Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455019 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
bc1495b0f0
commit
112a8b682d
@ -511,17 +511,20 @@ _compress_operation(struct spdk_reduce_backing_dev *backing_dev, struct iovec *s
|
|||||||
/* We always expect 1 got queued, if 0 then we need to queue it up. */
|
/* We always expect 1 got queued, if 0 then we need to queue it up. */
|
||||||
if (rc == 1) {
|
if (rc == 1) {
|
||||||
return 0;
|
return 0;
|
||||||
|
} else {
|
||||||
|
/* we free mbufs differently depending on whether they were chained or not */
|
||||||
|
rte_pktmbuf_free(comp_op->m_src);
|
||||||
|
rte_pktmbuf_free(comp_op->m_dst);
|
||||||
|
goto error_enqueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Error cleanup paths. */
|
/* Error cleanup paths. */
|
||||||
for (i = 0; i < dst_iovcnt; i++) {
|
|
||||||
rte_pktmbuf_free((struct rte_mbuf *)&dst_mbufs[i]);
|
|
||||||
}
|
|
||||||
error_get_dst:
|
error_get_dst:
|
||||||
for (i = 0; i < src_iovcnt; i++) {
|
for (i = 0; i < src_iovcnt; i++) {
|
||||||
rte_pktmbuf_free((struct rte_mbuf *)&src_mbufs[i]);
|
rte_pktmbuf_free((struct rte_mbuf *)&src_mbufs[i]);
|
||||||
}
|
}
|
||||||
error_get_src:
|
error_get_src:
|
||||||
|
error_enqueue:
|
||||||
rte_comp_op_free(comp_op);
|
rte_comp_op_free(comp_op);
|
||||||
error_get_op:
|
error_get_op:
|
||||||
op_to_queue = calloc(1, sizeof(struct vbdev_comp_op));
|
op_to_queue = calloc(1, sizeof(struct vbdev_comp_op));
|
||||||
|
Loading…
Reference in New Issue
Block a user