[dm-devel] dm-cache: resize_cache_dev resizing to wrong size ?
Vincent Pelletier
plr.vincent at gmail.com
Sat Nov 30 11:58:42 UTC 2013
Hi.
CC'ing f494a9c6b1b6dd9a9f21bbb75d9210d478eeb498 author.
Please keep me CC'ed in replies, I'm not subscribed.
Wandering aimlessly in dm-cache source as of current linus master
(3.13-rc2, dc1ccc48159d63eca5089e507c82c7d22ef60839), I noticed this:
dm-cache-metadata.c:
int dm_cache_resize(struct dm_cache_metadata *cmd, dm_cblock_t new_cache_size)
Note second argument is new_cache_size. But caller is doing:
dm-cache-target.c:
static int resize_cache_dev(struct cache *cache, dm_cblock_t new_size)
[...]
r = dm_cache_resize(cache->cmd, cache->cache_size);
[...]
cache->cache_size = new_size;
dm_cache_resize is called with cache->cache_size before it gets updated
to new_size, so it looks like a no-op.
Can someone confirm my reading ?
If confirmed, the effect is that a shrink (only ? I'm not familiar with
cache metadata) operation can result in metadata inconsistent with
cache device size.
See attachment for proposed (untested) fix.
It applies cleanly as of current device-mapper for-next branch.
Regards,
--
Vincent Pelletier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-dm-cache-actually-shrink-cache-to-new-size.patch
Type: text/x-patch
Size: 911 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20131130/790ab16e/attachment.bin>
More information about the dm-devel
mailing list