Skip to content

Commit 0a8e959

Browse files
committed
dm: add WARN_ON_ONCE to dm_submit_bio_remap
If a target uses dm_submit_bio_remap() it should set ti->accounts_remapped_io. Also, switch dm_start_io_acct() WARN_ON to WARN_ON_ONCE. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
1 parent b99fdcd commit 0a8e959

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/md/dm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static void dm_start_io_acct(struct dm_io *io, struct bio *clone)
541541
* Expect no possibility for race unless is_duplicate_bio.
542542
*/
543543
if (!clone || likely(!clone_to_tio(clone)->is_duplicate_bio)) {
544-
if (WARN_ON(io->was_accounted))
544+
if (WARN_ON_ONCE(io->was_accounted))
545545
return;
546546
io->was_accounted = 1;
547547
} else if (xchg(&io->was_accounted, 1) == 1)
@@ -1202,6 +1202,8 @@ void dm_submit_bio_remap(struct bio *clone, struct bio *tgt_clone,
12021202
struct dm_target_io *tio = clone_to_tio(clone);
12031203
struct dm_io *io = tio->io;
12041204

1205+
WARN_ON_ONCE(!tio->ti->accounts_remapped_io);
1206+
12051207
/* establish bio that will get submitted */
12061208
if (!tgt_clone)
12071209
tgt_clone = clone;

0 commit comments

Comments
 (0)