All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nbd: ratelimit error messages from disconnected devices
@ 2016-02-16 10:33 Dmitry Monakhov
  2016-02-21 13:48 ` [Nbd] " Markus Pargmann
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Monakhov @ 2016-02-16 10:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: nbd-general, Dmitry Monakhov

ndb can be explicitly disconnected via NBD_DISCONNECT while
active user still exists this result in massive spam to logs.
Let's ratelimits such messages.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 drivers/block/nbd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index e4c5cc1..2dbe840 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -175,7 +175,7 @@ static int sock_xmit(struct nbd_device *nbd, int send, void *buf, int size,
 	unsigned long pflags = current->flags;
 
 	if (unlikely(!sock)) {
-		dev_err(disk_to_dev(nbd->disk),
+		dev_err_ratelimited(disk_to_dev(nbd->disk),
 			"Attempted %s on closed socket in sock_xmit\n",
 			(send ? "send" : "recv"));
 		return -EINVAL;
@@ -509,7 +509,7 @@ static void nbd_handle_req(struct nbd_device *nbd, struct request *req)
 	mutex_lock(&nbd->tx_lock);
 	if (unlikely(!nbd->sock)) {
 		mutex_unlock(&nbd->tx_lock);
-		dev_err(disk_to_dev(nbd->disk),
+		dev_err_ratelimited(disk_to_dev(nbd->disk),
 			"Attempted send on closed socket\n");
 		goto error_out;
 	}
@@ -618,7 +618,7 @@ static void nbd_request_handler(struct request_queue *q)
 			req, req->cmd_type);
 
 		if (unlikely(!nbd->sock)) {
-			dev_err(disk_to_dev(nbd->disk),
+			dev_err_ratelimited(disk_to_dev(nbd->disk),
 				"Attempted send on closed socket\n");
 			req->errors++;
 			nbd_end_request(nbd, req);
-- 
1.8.3.1

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

* Re: [Nbd] [PATCH] nbd: ratelimit error messages from disconnected devices
  2016-02-16 10:33 [PATCH] nbd: ratelimit error messages from disconnected devices Dmitry Monakhov
@ 2016-02-21 13:48 ` Markus Pargmann
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Pargmann @ 2016-02-21 13:48 UTC (permalink / raw)
  To: nbd-general; +Cc: Dmitry Monakhov, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1761 bytes --]

Hi,

On Tuesday 16 February 2016 14:33:01 Dmitry Monakhov wrote:
> ndb can be explicitly disconnected via NBD_DISCONNECT while
> active user still exists this result in massive spam to logs.
> Let's ratelimits such messages.
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  drivers/block/nbd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index e4c5cc1..2dbe840 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -175,7 +175,7 @@ static int sock_xmit(struct nbd_device *nbd, int send, void *buf, int size,
>  	unsigned long pflags = current->flags;
>  
>  	if (unlikely(!sock)) {
> -		dev_err(disk_to_dev(nbd->disk),
> +		dev_err_ratelimited(disk_to_dev(nbd->disk),
>  			"Attempted %s on closed socket in sock_xmit\n",

Please indent to the first opening bracket.

>  			(send ? "send" : "recv"));
>  		return -EINVAL;
> @@ -509,7 +509,7 @@ static void nbd_handle_req(struct nbd_device *nbd, struct request *req)
>  	mutex_lock(&nbd->tx_lock);
>  	if (unlikely(!nbd->sock)) {
>  		mutex_unlock(&nbd->tx_lock);
> -		dev_err(disk_to_dev(nbd->disk),
> +		dev_err_ratelimited(disk_to_dev(nbd->disk),
>  			"Attempted send on closed socket\n");
>  		goto error_out;
>  	}
> @@ -618,7 +618,7 @@ static void nbd_request_handler(struct request_queue *q)
>  			req, req->cmd_type);
>  
>  		if (unlikely(!nbd->sock)) {
> -			dev_err(disk_to_dev(nbd->disk),
> +			dev_err_ratelimited(disk_to_dev(nbd->disk),
>  				"Attempted send on closed socket\n");

This conflicts with a patch already applied fixing the same.
Please rebase onto nbd master [1]

Best Regards,

Markus

[1] http://git.pengutronix.de/?p=mpa/linux-nbd.git;a=shortlog;h=refs/heads/master

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2016-02-21 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-16 10:33 [PATCH] nbd: ratelimit error messages from disconnected devices Dmitry Monakhov
2016-02-21 13:48 ` [Nbd] " Markus Pargmann

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.