mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-kernel@vger.kernel.org
Cc: nbd-general@lists.sourceforge.net,
	Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH] nbd: ratelimit error messages from disconnected devices
Date: Tue, 16 Feb 2016 14:33:01 +0400	[thread overview]
Message-ID: <1455618781-26306-1-git-send-email-dmonakhov@openvz.org> (raw)

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

             reply	other threads:[~2016-02-16 10:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 10:33 Dmitry Monakhov [this message]
2016-02-21 13:48 ` [Nbd] " Markus Pargmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455618781-26306-1-git-send-email-dmonakhov@openvz.org \
    --to=dmonakhov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd-general@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®