Mike Snitzer 9571f829f3 dm table: fix dm_table_supports_poll to return false if no data devices
It was reported that the "generic/250" test in xfstests (which uses
the dm-error target) demonstrates a regression where the kernel
crashes in bioset_exit().

Since commit cfc97abcbe0b ("dm: conditionally enable
BIOSET_PERCPU_CACHE for dm_io bioset") the bioset_init() for the dm_io
bioset will setup the bioset's per-cpu alloc cache if all devices have
QUEUE_FLAG_POLL set.

But there was an bug where a target that doesn't have any data devices
(and that doesn't even set the .iterate_devices dm target callback)
will incorrectly return true from dm_table_supports_poll().

Fix this by updating dm_table_supports_poll() to follow dm-table.c's
well-worn pattern for testing that _all_ targets in a DM table do in
fact have underlying devices that set QUEUE_FLAG_POLL.

NOTE: An additional block fix is still needed so that
bio_alloc_cache_destroy() clears the bioset's ->cache member.
Otherwise, a DM device's table reload that transitions the DM device's
bioset from using a per-cpu alloc cache to _not_ using one will result
in bioset_exit() crashing in bio_alloc_cache_destroy() because dm's
dm_io bioset ("io_bs") was left with a stale ->cache member.

Fixes: cfc97abcbe0b ("dm: conditionally enable BIOSET_PERCPU_CACHE for dm_io bioset")
Reported-by: Matthew Wilcox <willy@infradead.org>
Reported-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
2022-05-31 14:44:17 -04:00
..
2022-05-05 17:31:35 -04:00
2022-05-05 17:31:35 -04:00
2022-05-05 17:31:35 -04:00
2022-04-17 19:49:59 -06:00
2022-03-24 19:37:53 -07:00
2022-05-11 13:58:52 -04:00
2022-01-06 08:37:03 -08:00
2022-04-17 19:49:59 -06:00
2022-03-24 19:37:53 -07:00
2022-02-22 21:11:08 -05:00
2022-04-17 19:49:59 -06:00
2022-03-08 15:16:54 -08:00
2022-04-17 19:49:59 -06:00
2022-03-08 15:16:54 -08:00
2019-03-12 10:15:18 -07:00
2022-03-26 11:51:46 -07:00
2022-04-17 19:49:59 -06:00
2022-01-06 08:37:02 -08:00
2022-04-17 19:49:59 -06:00
2022-03-08 15:16:54 -08:00