[1/5] blk-mq: Only register debugfs attributes for blk-mq queues
diff mbox

Message ID 20170525233810.23211-2-bart.vanassche@sandisk.com
State New
Headers show

Commit Message

Bart Van Assche May 25, 2017, 11:38 p.m. UTC
The code in blk-mq-debugfs.c assumes that it is working on a blk-mq
queue and is not intended to work on a blk-sq queue. Hence only
register blk-mq debugfs attributes for blk-mq queues.

Fixes: commit 9c1051aacde8 ("blk-mq: untangle debugfs and sysfs")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Omar Sandoval <osandov@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Ming Lei <ming.lei@redhat.com>
---
 block/blk-sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Omar Sandoval May 26, 2017, 12:23 a.m. UTC | #1
On Thu, May 25, 2017 at 04:38:06PM -0700, Bart Van Assche wrote:
> The code in blk-mq-debugfs.c assumes that it is working on a blk-mq
> queue and is not intended to work on a blk-sq queue. Hence only
> register blk-mq debugfs attributes for blk-mq queues.

Oops. This is probably what David reported here:
https://github.com/ddiss/rapido/pull/13#event-1093484761. Thanks, Bart.

Reviewed-by: Omar Sandoval <osandov@fb.com>

> Fixes: commit 9c1051aacde8 ("blk-mq: untangle debugfs and sysfs")
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Omar Sandoval <osandov@fb.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> ---
>  block/blk-sysfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> index 5e7b3924996c..0494baa743a3 100644
> --- a/block/blk-sysfs.c
> +++ b/block/blk-sysfs.c
> @@ -888,10 +888,10 @@ int blk_register_queue(struct gendisk *disk)
>  		goto unlock;
>  	}
>  
> -	if (q->mq_ops)
> +	if (q->mq_ops) {
>  		__blk_mq_register_dev(dev, q);
> -
> -	blk_mq_debugfs_register(q);
> +		blk_mq_debugfs_register(q);
> +	}
>  
>  	kobject_uevent(&q->kobj, KOBJ_ADD);
>  
> -- 
> 2.12.2
>
Hannes Reinecke May 26, 2017, 5:56 a.m. UTC | #2
On 05/26/2017 01:38 AM, Bart Van Assche wrote:
> The code in blk-mq-debugfs.c assumes that it is working on a blk-mq
> queue and is not intended to work on a blk-sq queue. Hence only
> register blk-mq debugfs attributes for blk-mq queues.
> 
> Fixes: commit 9c1051aacde8 ("blk-mq: untangle debugfs and sysfs")
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Omar Sandoval <osandov@fb.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> ---
>  block/blk-sysfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> index 5e7b3924996c..0494baa743a3 100644
> --- a/block/blk-sysfs.c
> +++ b/block/blk-sysfs.c
> @@ -888,10 +888,10 @@ int blk_register_queue(struct gendisk *disk)
>  		goto unlock;
>  	}
>  
> -	if (q->mq_ops)
> +	if (q->mq_ops) {
>  		__blk_mq_register_dev(dev, q);
> -
> -	blk_mq_debugfs_register(q);
> +		blk_mq_debugfs_register(q);
> +	}
>  
>  	kobject_uevent(&q->kobj, KOBJ_ADD);
>  
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
Jens Axboe May 26, 2017, 1:27 p.m. UTC | #3
On 05/25/2017 05:38 PM, Bart Van Assche wrote:
> The code in blk-mq-debugfs.c assumes that it is working on a blk-mq
> queue and is not intended to work on a blk-sq queue. Hence only
> register blk-mq debugfs attributes for blk-mq queues.

Thanks Bart, I have queued this up for this series.

Patch
diff mbox

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 5e7b3924996c..0494baa743a3 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -888,10 +888,10 @@  int blk_register_queue(struct gendisk *disk)
 		goto unlock;
 	}
 
-	if (q->mq_ops)
+	if (q->mq_ops) {
 		__blk_mq_register_dev(dev, q);
-
-	blk_mq_debugfs_register(q);
+		blk_mq_debugfs_register(q);
+	}
 
 	kobject_uevent(&q->kobj, KOBJ_ADD);