diff options
author | Mike Snitzer <snitzer@redhat.com> | 2018-11-09 17:56:03 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2018-12-07 22:04:09 +0100 |
commit | 687cf4412a343a63928a5c9d91bdc0f522939d43 (patch) | |
tree | a72edb30ab6964bfdb543c26391efffc4004d214 /drivers/md/dm-cache-metadata.c | |
parent | Linux 4.20-rc5 (diff) | |
download | linux-687cf4412a343a63928a5c9d91bdc0f522939d43.tar.xz linux-687cf4412a343a63928a5c9d91bdc0f522939d43.zip |
dm cache metadata: verify cache has blocks in blocks_are_clean_separate_dirty()
Otherwise dm_bitset_cursor_begin() return -ENODATA. Other calls to
dm_bitset_cursor_begin() have similar negative checks.
Fixes inability to create a cache in passthrough mode (even though doing
so makes no sense).
Fixes: 0d963b6e65 ("dm cache metadata: fix metadata2 format's blocks_are_clean_separate_dirty")
Cc: stable@vger.kernel.org
Reported-by: David Teigland <teigland@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-cache-metadata.c')
-rw-r--r-- | drivers/md/dm-cache-metadata.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c index 5936de71883f..6fc93834da44 100644 --- a/drivers/md/dm-cache-metadata.c +++ b/drivers/md/dm-cache-metadata.c @@ -930,6 +930,10 @@ static int blocks_are_clean_separate_dirty(struct dm_cache_metadata *cmd, bool dirty_flag; *result = true; + if (from_cblock(cmd->cache_blocks) == 0) + /* Nothing to do */ + return 0; + r = dm_bitset_cursor_begin(&cmd->dirty_info, cmd->dirty_root, from_cblock(cmd->cache_blocks), &cmd->dirty_cursor); if (r) { |