linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: ratelimite pr_err on IO path
@ 2018-04-11 13:21 Jack Wang
  2018-04-11 17:07 ` Elliott, Robert (Persistent Memory)
  0 siblings, 1 reply; 3+ messages in thread
From: Jack Wang @ 2018-04-11 13:21 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, Jack Wang

From: Jack Wang <jinpu.wang@profitbricks.com>

This avoid soft lockup below:
[ 2328.328429] Call Trace:
[ 2328.328433]  vprintk_emit+0x229/0x2e0
[ 2328.328436]  ? t10_pi_type3_verify_ip+0x20/0x20
[ 2328.328437]  printk+0x52/0x6e
[ 2328.328439]  t10_pi_verify+0x9e/0xf0
[ 2328.328441]  bio_integrity_process+0x12e/0x220
[ 2328.328442]  ? t10_pi_type1_verify_crc+0x20/0x20
[ 2328.328443]  bio_integrity_verify_fn+0xde/0x140
[ 2328.328447]  process_one_work+0x13f/0x370
[ 2328.328449]  worker_thread+0x62/0x3d0
[ 2328.328450]  ? rescuer_thread+0x2f0/0x2f0
[ 2328.328452]  kthread+0x116/0x150
[ 2328.328454]  ? __kthread_parkme+0x70/0x70
[ 2328.328457]  ret_from_fork+0x35/0x40

Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
---
 block/t10-pi.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/block/t10-pi.c b/block/t10-pi.c
index a98db38..35967d5 100644
--- a/block/t10-pi.c
+++ b/block/t10-pi.c
@@ -84,10 +84,12 @@ static blk_status_t t10_pi_verify(struct blk_integrity_iter *iter,
 
 			if (be32_to_cpu(pi->ref_tag) !=
 			    lower_32_bits(iter->seed)) {
-				pr_err("%s: ref tag error at location %llu " \
-				       "(rcvd %u)\n", iter->disk_name,
-				       (unsigned long long)
-				       iter->seed, be32_to_cpu(pi->ref_tag));
+				pr_err_ratelimited("%s: ref tag error at "
+						   "location %llu (rcvd %u)\n",
+						   iter->disk_name,
+						   (unsigned long long)
+						   iter->seed,
+						   be32_to_cpu(pi->ref_tag));
 				return BLK_STS_PROTECTION;
 			}
 			break;
@@ -101,10 +103,12 @@ static blk_status_t t10_pi_verify(struct blk_integrity_iter *iter,
 		csum = fn(iter->data_buf, iter->interval);
 
 		if (pi->guard_tag != csum) {
-			pr_err("%s: guard tag error at sector %llu " \
-			       "(rcvd %04x, want %04x)\n", iter->disk_name,
-			       (unsigned long long)iter->seed,
-			       be16_to_cpu(pi->guard_tag), be16_to_cpu(csum));
+			pr_err_ratelimited("%s: guard tag error at sector %llu "
+					   "(rcvd %04x, want %04x)\n",
+					   iter->disk_name,
+					   (unsigned long long)iter->seed,
+					   be16_to_cpu(pi->guard_tag),
+					   be16_to_cpu(csum));
 			return BLK_STS_PROTECTION;
 		}
 
-- 
2.7.4

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

* RE: [PATCH] block: ratelimite pr_err on IO path
  2018-04-11 13:21 [PATCH] block: ratelimite pr_err on IO path Jack Wang
@ 2018-04-11 17:07 ` Elliott, Robert (Persistent Memory)
  2018-04-12  8:56   ` Jinpu Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Elliott, Robert (Persistent Memory) @ 2018-04-11 17:07 UTC (permalink / raw)
  To: Jack Wang, axboe; +Cc: linux-block, linux-kernel

> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-
> owner@vger.kernel.org] On Behalf Of Jack Wang
> Sent: Wednesday, April 11, 2018 8:21 AM
> Subject: [PATCH] block: ratelimite pr_err on IO path
> 
> From: Jack Wang <jinpu.wang@profitbricks.com>
...
> -				pr_err("%s: ref tag error at location %llu " \
> -				       "(rcvd %u)\n", iter->disk_name,
> -				       (unsigned long long)
> -				       iter->seed, be32_to_cpu(pi->ref_tag));
> +				pr_err_ratelimited("%s: ref tag error at "
> +						   "location %llu (rcvd %u)\n",

Per process/coding-style.rst, you should keep a string like that on
one line even if that exceeds 80 columns:

  Statements longer than 80 columns will be broken into sensible chunks, unless
  exceeding 80 columns significantly increases readability and does not hide
  information. ... However, never break user-visible strings such as
  printk messages, because that breaks the ability to grep for them.

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

* Re: [PATCH] block: ratelimite pr_err on IO path
  2018-04-11 17:07 ` Elliott, Robert (Persistent Memory)
@ 2018-04-12  8:56   ` Jinpu Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Jinpu Wang @ 2018-04-12  8:56 UTC (permalink / raw)
  To: Elliott, Robert (Persistent Memory); +Cc: axboe, linux-block, linux-kernel

On Wed, Apr 11, 2018 at 7:07 PM, Elliott, Robert (Persistent Memory)
<elliott@hpe.com> wrote:
>> -----Original Message-----
>> From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-
>> owner@vger.kernel.org] On Behalf Of Jack Wang
>> Sent: Wednesday, April 11, 2018 8:21 AM
>> Subject: [PATCH] block: ratelimite pr_err on IO path
>>
>> From: Jack Wang <jinpu.wang@profitbricks.com>
> ...
>> -                             pr_err("%s: ref tag error at location %llu " \
>> -                                    "(rcvd %u)\n", iter->disk_name,
>> -                                    (unsigned long long)
>> -                                    iter->seed, be32_to_cpu(pi->ref_tag));
>> +                             pr_err_ratelimited("%s: ref tag error at "
>> +                                                "location %llu (rcvd %u)\n",
>
> Per process/coding-style.rst, you should keep a string like that on
> one line even if that exceeds 80 columns:
>
>   Statements longer than 80 columns will be broken into sensible chunks, unless
>   exceeding 80 columns significantly increases readability and does not hide
>   information. ... However, never break user-visible strings such as
>   printk messages, because that breaks the ability to grep for them.
>
>
Thanks Robert, as the original code keep the 80 columns, I just
followed, I will fix it in v2.


-- 
Jack Wang
Linux Kernel Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

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

end of thread, other threads:[~2018-04-12  8:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11 13:21 [PATCH] block: ratelimite pr_err on IO path Jack Wang
2018-04-11 17:07 ` Elliott, Robert (Persistent Memory)
2018-04-12  8:56   ` Jinpu Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).