Re: [PATCH] Block: fix unbalanced bypass-disable in blk_register_queue

2014-09-09 Thread Shirish Pargaonkar
Tested-by: Shirish Pargaonkar 

On Tue, Sep 9, 2014 at 10:50 AM, Alan Stern  wrote:
> When a queue is registered, the block layer turns off the bypass
> setting (because bypass is enabled when the queue is created).  This
> doesn't work well for queues that are unregistered and then registered
> again; we get a WARNING because of the unbalanced calls to
> blk_queue_bypass_end().
>
> This patch fixes the problem by making blk_register_queue() call
> blk_queue_bypass_end() only the first time the queue is registered.
>
> Signed-off-by: Alan Stern 
> CC: Tejun Heo 
> CC: James Bottomley 
> CC: Jens Axboe 
>
> ---
>
> [as1765]
>
>
>  block/blk-sysfs.c |6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> Index: usb-3.17/block/blk-sysfs.c
> ===
> --- usb-3.17.orig/block/blk-sysfs.c
> +++ usb-3.17/block/blk-sysfs.c
> @@ -554,8 +554,10 @@ int blk_register_queue(struct gendisk *d
>  * Initialization must be complete by now.  Finish the initial
>  * bypass from queue allocation.
>  */
> -   queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q);
> -   blk_queue_bypass_end(q);
> +   if (!blk_queue_init_done(q)) {
> +   queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q);
> +   blk_queue_bypass_end(q);
> +   }
>
> ret = blk_trace_init_sysfs(dev);
> if (ret)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Block: fix unbalanced bypass-disable in blk_register_queue

2014-09-09 Thread Tejun Heo
On Tue, Sep 09, 2014 at 11:50:58AM -0400, Alan Stern wrote:
> When a queue is registered, the block layer turns off the bypass
> setting (because bypass is enabled when the queue is created).  This
> doesn't work well for queues that are unregistered and then registered
> again; we get a WARNING because of the unbalanced calls to
> blk_queue_bypass_end().
> 
> This patch fixes the problem by making blk_register_queue() call
> blk_queue_bypass_end() only the first time the queue is registered.
> 
> Signed-off-by: Alan Stern 
> CC: Tejun Heo 
> CC: James Bottomley 
> CC: Jens Axboe 

Acked-by: Tejun Heo 

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Block: fix unbalanced bypass-disable in blk_register_queue

2014-09-09 Thread Alan Stern
When a queue is registered, the block layer turns off the bypass
setting (because bypass is enabled when the queue is created).  This
doesn't work well for queues that are unregistered and then registered
again; we get a WARNING because of the unbalanced calls to
blk_queue_bypass_end().

This patch fixes the problem by making blk_register_queue() call
blk_queue_bypass_end() only the first time the queue is registered.

Signed-off-by: Alan Stern 
CC: Tejun Heo 
CC: James Bottomley 
CC: Jens Axboe 

---

[as1765]


 block/blk-sysfs.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: usb-3.17/block/blk-sysfs.c
===
--- usb-3.17.orig/block/blk-sysfs.c
+++ usb-3.17/block/blk-sysfs.c
@@ -554,8 +554,10 @@ int blk_register_queue(struct gendisk *d
 * Initialization must be complete by now.  Finish the initial
 * bypass from queue allocation.
 */
-   queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q);
-   blk_queue_bypass_end(q);
+   if (!blk_queue_init_done(q)) {
+   queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q);
+   blk_queue_bypass_end(q);
+   }
 
ret = blk_trace_init_sysfs(dev);
if (ret)

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html