All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fixes for kernel v4.13
@ 2017-06-21 17:55 Bart Van Assche
  2017-06-21 17:55 ` [PATCH 1/3] block: Declare local symbols static Bart Van Assche
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Bart Van Assche @ 2017-06-21 17:55 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Christoph Hellwig, Bart Van Assche

Hello Jens,

The three patches in this series fix issues in the patches that are queued
for kernel v4.13. Please consider these for kernel v4.13.

Thanks,

Bart.

Bart Van Assche (3):
  block: Declare local symbols static
  block: Fix off-by-one errors in blk_status_to_errno() and
    print_req_error()
  blk-mq: Make it safe to quiesce and unquiesce from an interrupt
    handler

 block/blk-core.c       |  4 ++--
 block/blk-mq.c         | 20 ++++++++++++++++++--
 block/bounce.c         |  2 +-
 include/linux/blk-mq.h | 10 +---------
 4 files changed, 22 insertions(+), 14 deletions(-)

-- 
2.13.1

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

* [PATCH 1/3] block: Declare local symbols static
  2017-06-21 17:55 [PATCH 0/3] Fixes for kernel v4.13 Bart Van Assche
@ 2017-06-21 17:55 ` Bart Van Assche
  2017-06-21 17:55 ` [PATCH 2/3] block: Fix off-by-one errors in blk_status_to_errno() and print_req_error() Bart Van Assche
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Bart Van Assche @ 2017-06-21 17:55 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Bart Van Assche, Neil Brown,
	Hannes Reinecke, Ming Lei

Avoid that building with W=1 causes the compiler to complain that
a declaration for bounce_bio_set and bounce_bio_split is missing.

References: commit a8821f3f32be ("block: Improvements to bounce-buffer handling")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Neil Brown <neilb@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Ming Lei <ming.lei@redhat.com>
---
 block/bounce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/bounce.c b/block/bounce.c
index 17d77613c471..916ee9a9a216 100644
--- a/block/bounce.c
+++ b/block/bounce.c
@@ -26,7 +26,7 @@
 #define POOL_SIZE	64
 #define ISA_POOL_SIZE	16
 
-struct bio_set *bounce_bio_set, *bounce_bio_split;
+static struct bio_set *bounce_bio_set, *bounce_bio_split;
 static mempool_t *page_pool, *isa_page_pool;
 
 #if defined(CONFIG_HIGHMEM) || defined(CONFIG_NEED_BOUNCE_POOL)
-- 
2.13.1

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

* [PATCH 2/3] block: Fix off-by-one errors in blk_status_to_errno() and print_req_error()
  2017-06-21 17:55 [PATCH 0/3] Fixes for kernel v4.13 Bart Van Assche
  2017-06-21 17:55 ` [PATCH 1/3] block: Declare local symbols static Bart Van Assche
@ 2017-06-21 17:55 ` Bart Van Assche
  2017-06-21 17:55 ` [PATCH 3/3] blk-mq: Make it safe to quiesce and unquiesce from an interrupt handler Bart Van Assche
  2017-06-21 18:01 ` [PATCH 0/3] Fixes for kernel v4.13 Jens Axboe
  3 siblings, 0 replies; 6+ messages in thread
From: Bart Van Assche @ 2017-06-21 17:55 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Bart Van Assche, Hannes Reinecke,
	Ming Lei

This was detected by the smatch static analyzer.

Fixes: commit 2a842acab109 ("block: introduce new block status code type")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Ming Lei <ming.lei@redhat.com>
---
 block/blk-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 2e02314ea331..3c18ea60cb1c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -169,7 +169,7 @@ int blk_status_to_errno(blk_status_t status)
 {
 	int idx = (__force int)status;
 
-	if (WARN_ON_ONCE(idx > ARRAY_SIZE(blk_errors)))
+	if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
 		return -EIO;
 	return blk_errors[idx].errno;
 }
@@ -179,7 +179,7 @@ static void print_req_error(struct request *req, blk_status_t status)
 {
 	int idx = (__force int)status;
 
-	if (WARN_ON_ONCE(idx > ARRAY_SIZE(blk_errors)))
+	if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
 		return;
 
 	printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu\n",
-- 
2.13.1

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

* [PATCH 3/3] blk-mq: Make it safe to quiesce and unquiesce from an interrupt handler
  2017-06-21 17:55 [PATCH 0/3] Fixes for kernel v4.13 Bart Van Assche
  2017-06-21 17:55 ` [PATCH 1/3] block: Declare local symbols static Bart Van Assche
  2017-06-21 17:55 ` [PATCH 2/3] block: Fix off-by-one errors in blk_status_to_errno() and print_req_error() Bart Van Assche
@ 2017-06-21 17:55 ` Bart Van Assche
  2017-06-22 10:32   ` Ming Lei
  2017-06-21 18:01 ` [PATCH 0/3] Fixes for kernel v4.13 Jens Axboe
  3 siblings, 1 reply; 6+ messages in thread
From: Bart Van Assche @ 2017-06-21 17:55 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Bart Van Assche, Ming Lei,
	Hannes Reinecke, Martin K . Petersen

Since blk_mq_quiesce_queue_nowait() can be called from interrupt
context, make this safe. Since this function is not in the hot
path, uninline it.

Fixes: commit f4560ffe8cec ("blk-mq: use QUEUE_FLAG_QUIESCED to quiesce queue")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
---
 block/blk-mq.c         | 20 ++++++++++++++++++--
 include/linux/blk-mq.h | 10 +---------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 1c4f1f4978c6..2caac30e128a 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -153,6 +153,20 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
 }
 EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue);
 
+/*
+ * FIXME: replace the scsi_internal_device_*block_nowait() calls in the
+ * mpt3sas driver such that this function can be removed.
+ */
+void blk_mq_quiesce_queue_nowait(struct request_queue *q)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(q->queue_lock, flags);
+	queue_flag_set(QUEUE_FLAG_QUIESCED, q);
+	spin_unlock_irqrestore(q->queue_lock, flags);
+}
+EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue_nowait);
+
 /**
  * blk_mq_quiesce_queue() - wait until all ongoing dispatches have finished
  * @q: request queue.
@@ -190,9 +204,11 @@ EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue);
  */
 void blk_mq_unquiesce_queue(struct request_queue *q)
 {
-	spin_lock_irq(q->queue_lock);
+	unsigned long flags;
+
+	spin_lock_irqsave(q->queue_lock, flags);
 	queue_flag_clear(QUEUE_FLAG_QUIESCED, q);
-	spin_unlock_irq(q->queue_lock);
+	spin_unlock_irqrestore(q->queue_lock, flags);
 
 	/* dispatch requests which are inserted during quiescing */
 	blk_mq_run_hw_queues(q, true);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 366b83cee955..23d32ff0b462 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -266,15 +266,7 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set);
 int blk_mq_map_queues(struct blk_mq_tag_set *set);
 void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues);
 
-/*
- * FIXME: this helper is just for working around mpt3sas.
- */
-static inline void blk_mq_quiesce_queue_nowait(struct request_queue *q)
-{
-	spin_lock_irq(q->queue_lock);
-	queue_flag_set(QUEUE_FLAG_QUIESCED, q);
-	spin_unlock_irq(q->queue_lock);
-}
+void blk_mq_quiesce_queue_nowait(struct request_queue *q);
 
 /*
  * Driver command data is immediately after the request. So subtract request
-- 
2.13.1

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

* Re: [PATCH 0/3] Fixes for kernel v4.13
  2017-06-21 17:55 [PATCH 0/3] Fixes for kernel v4.13 Bart Van Assche
                   ` (2 preceding siblings ...)
  2017-06-21 17:55 ` [PATCH 3/3] blk-mq: Make it safe to quiesce and unquiesce from an interrupt handler Bart Van Assche
@ 2017-06-21 18:01 ` Jens Axboe
  3 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2017-06-21 18:01 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-block, Christoph Hellwig

On 06/21/2017 11:55 AM, Bart Van Assche wrote:
> Hello Jens,
> 
> The three patches in this series fix issues in the patches that are queued
> for kernel v4.13. Please consider these for kernel v4.13.
> 
> Thanks,
> 
> Bart.
> 
> Bart Van Assche (3):
>   block: Declare local symbols static
>   block: Fix off-by-one errors in blk_status_to_errno() and
>     print_req_error()
>   blk-mq: Make it safe to quiesce and unquiesce from an interrupt
>     handler

Looks good to me, applied.

-- 
Jens Axboe

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

* Re: [PATCH 3/3] blk-mq: Make it safe to quiesce and unquiesce from an interrupt handler
  2017-06-21 17:55 ` [PATCH 3/3] blk-mq: Make it safe to quiesce and unquiesce from an interrupt handler Bart Van Assche
@ 2017-06-22 10:32   ` Ming Lei
  0 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2017-06-22 10:32 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Hannes Reinecke,
	Martin K . Petersen

On Wed, Jun 21, 2017 at 10:55:47AM -0700, Bart Van Assche wrote:
> Since blk_mq_quiesce_queue_nowait() can be called from interrupt
> context, make this safe. Since this function is not in the hot
> path, uninline it.
> 
> Fixes: commit f4560ffe8cec ("blk-mq: use QUEUE_FLAG_QUIESCED to quiesce queue")
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>  block/blk-mq.c         | 20 ++++++++++++++++++--
>  include/linux/blk-mq.h | 10 +---------
>  2 files changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 1c4f1f4978c6..2caac30e128a 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -153,6 +153,20 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
>  }
>  EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue);
>  
> +/*
> + * FIXME: replace the scsi_internal_device_*block_nowait() calls in the
> + * mpt3sas driver such that this function can be removed.
> + */
> +void blk_mq_quiesce_queue_nowait(struct request_queue *q)
> +{
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(q->queue_lock, flags);
> +	queue_flag_set(QUEUE_FLAG_QUIESCED, q);
> +	spin_unlock_irqrestore(q->queue_lock, flags);
> +}
> +EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue_nowait);
> +
>  /**
>   * blk_mq_quiesce_queue() - wait until all ongoing dispatches have finished
>   * @q: request queue.
> @@ -190,9 +204,11 @@ EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue);
>   */
>  void blk_mq_unquiesce_queue(struct request_queue *q)
>  {
> -	spin_lock_irq(q->queue_lock);
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(q->queue_lock, flags);
>  	queue_flag_clear(QUEUE_FLAG_QUIESCED, q);
> -	spin_unlock_irq(q->queue_lock);
> +	spin_unlock_irqrestore(q->queue_lock, flags);
>  
>  	/* dispatch requests which are inserted during quiescing */
>  	blk_mq_run_hw_queues(q, true);
> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index 366b83cee955..23d32ff0b462 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -266,15 +266,7 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set);
>  int blk_mq_map_queues(struct blk_mq_tag_set *set);
>  void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues);
>  
> -/*
> - * FIXME: this helper is just for working around mpt3sas.
> - */
> -static inline void blk_mq_quiesce_queue_nowait(struct request_queue *q)
> -{
> -	spin_lock_irq(q->queue_lock);
> -	queue_flag_set(QUEUE_FLAG_QUIESCED, q);
> -	spin_unlock_irq(q->queue_lock);
> -}
> +void blk_mq_quiesce_queue_nowait(struct request_queue *q);
>  
>  /*
>   * Driver command data is immediately after the request. So subtract request
> -- 
> 2.13.1
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming

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

end of thread, other threads:[~2017-06-22 10:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 17:55 [PATCH 0/3] Fixes for kernel v4.13 Bart Van Assche
2017-06-21 17:55 ` [PATCH 1/3] block: Declare local symbols static Bart Van Assche
2017-06-21 17:55 ` [PATCH 2/3] block: Fix off-by-one errors in blk_status_to_errno() and print_req_error() Bart Van Assche
2017-06-21 17:55 ` [PATCH 3/3] blk-mq: Make it safe to quiesce and unquiesce from an interrupt handler Bart Van Assche
2017-06-22 10:32   ` Ming Lei
2017-06-21 18:01 ` [PATCH 0/3] Fixes for kernel v4.13 Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.