Skip to content

Commit 64eb88d

Browse files
bmarzinsMike Snitzer
authored andcommitted
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: 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>
1 parent d14646f commit 64eb88d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/md/dm-delay.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,18 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
242242
ret = delay_class_ctr(ti, &dc->flush, argv);
243243
if (ret)
244244
goto bad;
245-
max_delay = max(max_delay, dc->write.delay);
246-
max_delay = max(max_delay, dc->flush.delay);
247245
goto out;
248246
}
249247

250248
ret = delay_class_ctr(ti, &dc->write, argv + 3);
251249
if (ret)
252250
goto bad;
251+
max_delay = max(max_delay, dc->write.delay);
252+
253253
if (argc == 6) {
254254
ret = delay_class_ctr(ti, &dc->flush, argv + 3);
255255
if (ret)
256256
goto bad;
257-
max_delay = max(max_delay, dc->flush.delay);
258257
goto out;
259258
}
260259

0 commit comments

Comments
 (0)