]> git.baikalelectronics.ru Git - kernel.git/commit
dm: fix race in dm_start_io_acct
authorBenjamin Marzinski <bmarzins@redhat.com>
Tue, 14 Jun 2022 16:10:28 +0000 (11:10 -0500)
committerMike Snitzer <snitzer@kernel.org>
Wed, 15 Jun 2022 15:51:41 +0000 (11:51 -0400)
commit24a26fea50e205b022886630990e2587f96b3c75
treec1a72661ab3a31ea4c6155918bbb979ebbec522f
parentb52d5a6d90c5addd271912240e89be49abd74565
dm: fix race in dm_start_io_acct

After commit f12fa097000ab ("dm: switch dm_io booleans over to proper
flags") dm_start_io_acct stopped atomically checking and setting
was_accounted, which turned into the DM_IO_ACCOUNTED flag. This opened
the possibility for a race where IO accounting is started twice for
duplicate bios. To remove the race, check the flag while holding the
io->lock.

Fixes: f12fa097000ab ("dm: switch dm_io booleans over to proper flags")
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm.c