Linux block layer
 help / color / mirror / Atom feed
* [PATCH] bcache: check all uuid elements when start flash only volumes
@ 2018-02-26 16:10 Coly Li
  2018-02-26 16:15 ` Coly Li
  0 siblings, 1 reply; 3+ messages in thread
From: Coly Li @ 2018-02-26 16:10 UTC (permalink / raw)
  To: linux-bcache; +Cc: linux-block, Coly Li, Michael Lyle

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.

Fixes: 2831231d4c3f ("bcache: reduce cache_set devices iteration by devices_max_used")
Reported-by: Tang Junhui <tang.junhui@zte.com.cn>
Signed-off-by: Coly Li <colyli@suse.de>
Cc: Michael Lyle <mlyle@lyle.org>
---
 drivers/md/bcache/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 312895788036..4d1d8dfb2d2a 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -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);
-- 
2.16.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bcache: check all uuid elements when start flash only volumes
  2018-02-26 16:10 [PATCH] bcache: check all uuid elements when start flash only volumes Coly Li
@ 2018-02-26 16:15 ` Coly Li
  2018-02-27  3:54   ` Michael Lyle
  0 siblings, 1 reply; 3+ messages in thread
From: Coly Li @ 2018-02-26 16:15 UTC (permalink / raw)
  To: Michael Lyle, Jens Axboe; +Cc: linux-bcache, linux-block

On 27/02/2018 12:10 AM, Coly Li wrote:
> 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.
> 
> Fixes: 2831231d4c3f ("bcache: reduce cache_set devices iteration by devices_max_used")
> Reported-by: Tang Junhui <tang.junhui@zte.com.cn>
> Signed-off-by: Coly Li <colyli@suse.de>
> Cc: Michael Lyle <mlyle@lyle.org>
> ---
>  drivers/md/bcache/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index 312895788036..4d1d8dfb2d2a 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bcache: check all uuid elements when start flash only volumes
  2018-02-26 16:15 ` Coly Li
@ 2018-02-27  3:54   ` Michael Lyle
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Lyle @ 2018-02-27  3:54 UTC (permalink / raw)
  To: Coly Li, Jens Axboe; +Cc: linux-bcache, linux-block

Reviewed-by: Michael Lyle <mlyle@lyle.org>

I 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

On 02/26/2018 08:15 AM, Coly Li wrote:
> On 27/02/2018 12:10 AM, Coly Li wrote:
>> 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.
>>
>> Fixes: 2831231d4c3f ("bcache: reduce cache_set devices iteration by devices_max_used")
>> Reported-by: Tang Junhui <tang.junhui@zte.com.cn>
>> Signed-off-by: Coly Li <colyli@suse.de>
>> Cc: Michael Lyle <mlyle@lyle.org>
>> ---
>>  drivers/md/bcache/super.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
>> index 312895788036..4d1d8dfb2d2a 100644
>> --- a/drivers/md/bcache/super.c
>> +++ b/drivers/md/bcache/super.c
>> @@ -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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-27  3:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-26 16:10 [PATCH] bcache: check all uuid elements when start flash only volumes Coly Li
2018-02-26 16:15 ` Coly Li
2018-02-27  3:54   ` Michael Lyle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox