dm thin metadata: check if in fail_io mode when setting needs_check
authorMike Snitzer <snitzer@redhat.com>
Tue, 2 Jul 2019 19:50:08 +0000 (15:50 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Sep 2019 06:22:21 +0000 (08:22 +0200)
commitecf99cdea02dcc792c27a52d1cf3e1c532551479
treec87006a9ea24316b10607ec034bb182d10440894
parent5e9a2ce6d3b4a50a0abf754505e5a5ca32bccde5
dm thin metadata: check if in fail_io mode when setting needs_check

[ Upstream commit 54fa16ee532705985e6c946da455856f18f63ee1 ]

Check if in fail_io mode at start of dm_pool_metadata_set_needs_check().
Otherwise dm_pool_metadata_set_needs_check()'s superblock_lock() can
crash in dm_bm_write_lock() while accessing the block manager object
that was previously destroyed as part of a failed
dm_pool_abort_metadata() that ultimately set fail_io to begin with.

Also, update DMERR() message to more accurately describe
superblock_lock() failure.

Cc: stable@vger.kernel.org
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/dm-thin-metadata.c