Skip to content

Commit

Permalink
Merge pull request #51828 from petrutlucian94/it_decrement_issue
Browse files Browse the repository at this point in the history
librbd: avoid decrementing iterator before first element

Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
idryomov committed May 31, 2023
2 parents 0e90958 + ca65e85 commit a5483da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/librbd/io/SimpleSchedulerObjectDispatch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ bool SimpleSchedulerObjectDispatch<I>::ObjectRequests::try_delay_request(

// try to merge back to an existing request
iter = m_delayed_requests.lower_bound(object_off);
if (iter == m_delayed_requests.end() || iter->first > object_off) {
if (iter != m_delayed_requests.begin() &&
(iter == m_delayed_requests.end() || iter->first > object_off)) {
iter--;
}
if (iter != m_delayed_requests.end() &&
Expand Down

0 comments on commit a5483da

Please sign in to comment.