Prevent race condition in fast path

Request submitted in fast path may be freed before the sequential cutoff stats
are updated. Increment request reference counter to prevent it.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2021-12-07 11:06:57 +01:00
parent aac21cab63
commit 244712b020

View File

@ -302,12 +302,16 @@ void ocf_core_volume_submit_io(struct ocf_io *io)
ocf_core_update_stats(core, io);
ocf_io_get(io);
/* Prevent race condition */
ocf_req_get(req);
if (!ocf_core_submit_io_fast(io, req, core, cache)) {
ocf_core_seq_cutoff_update(core, req);
ocf_req_put(req);
return;
}
ocf_req_put(req);
ocf_req_clear_map(req);
ocf_core_seq_cutoff_update(core, req);