Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm thin metadata: fix a race when entering fail mode

In dm_thin_find_block() the ->fail_io flag was checked outside the
metadata device's root_lock, causing dm_thin_find_block() to race with
the setting of this flag.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Joe Thornber and committed by
Mike Snitzer
b1f11aff fd467696

+4 -3
+4 -3
drivers/md/dm-thin-metadata.c
··· 1390 1390 dm_block_t keys[2] = { td->id, block }; 1391 1391 struct dm_btree_info *info; 1392 1392 1393 - if (pmd->fail_io) 1394 - return -EINVAL; 1395 - 1396 1393 down_read(&pmd->root_lock); 1394 + if (pmd->fail_io) { 1395 + up_read(&pmd->root_lock); 1396 + return -EINVAL; 1397 + } 1397 1398 1398 1399 if (can_issue_io) { 1399 1400 info = &pmd->info;