bcache: check all uuid elements when start flash only volumes
Subsystems (2)
PATCH 1/1 bcache: check all uuid elements when start flash only volumes
Commit 2831231d4c3f ("bcache: reduce cache_set devices iteration by devices_max_used") adds c->devices_max_used to reduce iteration of c->uuids elements, this value is updated in bcache_device_attach().
But for flash only volume, when calling flash_devs_run(), the function bcache_device_attach() is not called yet and c->devices_max_used is not updated. The unexpected result is, the flash only volume won't be run by flash_devs_run().
This patch fixes the issue by iterate all c->uuids elements in flash_devs_run(). c->devices_max_used will be updated properly when bcache_device_attach() gets called.
--- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/super.c +1 -1
@@ -1274,7 +1274,7 @@ static int flash_devs_run(struct cache_set *c)struct uuid_entry *u;for (u = c->uuids; - u < c->uuids + c->devices_max_used && !ret; + u < c->uuids + c->nr_uuids && !ret; u++)if (UUID_FLASH_ONLY (u)) ret =flash_dev_run (c, u);
Signature · 1 line
2.16.1
Quoted 27 lines · Coly Li
Commit
2831231d4c3f("bcache: reducecache_setdevices iteration bydevices_max_used") addsc->devices_max_usedto reduce iteration ofc->uuidselements, this value is updated inbcache_device_attach().But for flash only volume, when calling
flash_devs_run(), the functionbcache_device_attach()is not called yet andc->devices_max_usedis not updated. The unexpected result is, the flash only volume won't be run byflash_devs_run().This patch fixes the issue by iterate all
c->uuidselements inflash_devs_run().c->devices_max_usedwill be updated properly whenbcache_device_attach()gets called.Fixes 2831231d4c3f ("bcache: reduce cache_set devices iteration by devices_max_used")Reported-by Tang Junhui <[email protected]>Signed-off-by Coly Li <[email protected]>Cc Michael Lyle <[email protected]>--- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/md/bcache/super.c +0
-0
drivers/md/bcache/super.c static int flash_devs_run(struct cache_set *c) · line 1280
Quoted 8 lines
drivers/md/bcache/super.c +1
-1@@ -1274,7 +1274,7 @@ static int flash_devs_run(struct cache_set *c)struct uuid_entry *u;for (u = c->uuids; - u < c->uuids + c->devices_max_used && !ret; + u < c->uuids + c->nr_uuids && !ret; u++)if (UUID_FLASH_ONLY (u)) ret =flash_dev_run (c, u);
Hi Jens and Michael,
Could you please have a look and pick this fix into 4.16 ? Commit 2831231d4c3f ("bcache: reduce cache_set devices iteration by devices_max_used") is just merged in 4.16-rc1, so I don't CC stable for this fix.
And I still need a peer code reviewer on this patch, any Reviewed-by is welcome.
Thanks to Junhui Tang for reporting this issue today.
Coly Li
Michael Lyle
Reviewed-byI have this and the other fix in the queue for testing tomorrow and will pass along a changeset to Jens if all looks good. Thanks!
Mike
Quoted 56 lines · Coly Li
Quoted 27 lines · Coly Li
Commit
2831231d4c3f("bcache: reducecache_setdevices iteration bydevices_max_used") addsc->devices_max_usedto reduce iteration ofc->uuidselements, this value is updated inbcache_device_attach().But for flash only volume, when calling
flash_devs_run(), the functionbcache_device_attach()is not called yet andc->devices_max_usedis not updated. The unexpected result is, the flash only volume won't be run byflash_devs_run().This patch fixes the issue by iterate all
c->uuidselements inflash_devs_run().c->devices_max_usedwill be updated properly whenbcache_device_attach()gets called.Fixes 2831231d4c3f ("bcache: reduce cache_set devices iteration by devices_max_used")Reported-by Tang Junhui <[email protected]>Signed-off-by Coly Li <[email protected]>Cc Michael Lyle <[email protected]>--- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/md/bcache/super.c +0
-0drivers/md/bcache/super.c static int flash_devs_run(struct cache_set *c) · line 1280
Quoted 8 lines
drivers/md/bcache/super.c +1
-1@@ -1274,7 +1274,7 @@ static int flash_devs_run(struct cache_set *c)struct uuid_entry *u;for (u = c->uuids; - u < c->uuids + c->devices_max_used && !ret; + u < c->uuids + c->nr_uuids && !ret; u++)if (UUID_FLASH_ONLY (u)) ret =flash_dev_run (c, u);Hi Jens and Michael,
Could you please have a look and pick this fix into 4.16 ? Commit
2831231d4c3f("bcache: reducecache_setdevices iteration bydevices_max_used") is just merged in 4.16-rc1, so I don't CC stable for this fix.And I still need a peer code reviewer on this patch, any Reviewed-by is welcome.
Thanks to Junhui Tang for reporting this issue today.
Coly Li
--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html