Skip to content

Commit

Permalink
dm-delay: fix max_delay calculations
Browse files Browse the repository at this point in the history
delay_ctr() pointlessly compared max_delay in cases where multiple delay
classes were initialized identically. Also, when write delays were
configured different than read delays, delay_ctr() never compared their
value against max_delay. Fix these issues.

Fixes: 70bbeb2 ("dm delay: for short delays, use kthread instead of timers and wq")
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
  • Loading branch information
bmarzins authored and Mike Snitzer committed May 9, 2024
1 parent d14646f commit 64eb88d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/md/dm-delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,18 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
ret = delay_class_ctr(ti, &dc->flush, argv);
if (ret)
goto bad;
max_delay = max(max_delay, dc->write.delay);
max_delay = max(max_delay, dc->flush.delay);
goto out;
}

ret = delay_class_ctr(ti, &dc->write, argv + 3);
if (ret)
goto bad;
max_delay = max(max_delay, dc->write.delay);

if (argc == 6) {
ret = delay_class_ctr(ti, &dc->flush, argv + 3);
if (ret)
goto bad;
max_delay = max(max_delay, dc->flush.delay);
goto out;
}

Expand Down

0 comments on commit 64eb88d

Please sign in to comment.