Commit 64eb88d6 authored by Benjamin Marzinski's avatar Benjamin Marzinski Committed by Mike Snitzer

dm-delay: fix max_delay calculations

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: 70bbeb29 ("dm delay: for short delays, use kthread instead of timers and wq")
Signed-off-by: default avatarBenjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
parent d14646f2
...@@ -242,19 +242,18 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -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); ret = delay_class_ctr(ti, &dc->flush, argv);
if (ret) if (ret)
goto bad; goto bad;
max_delay = max(max_delay, dc->write.delay);
max_delay = max(max_delay, dc->flush.delay);
goto out; goto out;
} }
ret = delay_class_ctr(ti, &dc->write, argv + 3); ret = delay_class_ctr(ti, &dc->write, argv + 3);
if (ret) if (ret)
goto bad; goto bad;
max_delay = max(max_delay, dc->write.delay);
if (argc == 6) { if (argc == 6) {
ret = delay_class_ctr(ti, &dc->flush, argv + 3); ret = delay_class_ctr(ti, &dc->flush, argv + 3);
if (ret) if (ret)
goto bad; goto bad;
max_delay = max(max_delay, dc->flush.delay);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment