linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nbd: use dev_err_ratelimited in io path
@ 2016-12-05 21:20 Josef Bacik
  2016-12-05 21:27 ` [Nbd] " Eric Blake
  2016-12-08 22:28 ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Josef Bacik @ 2016-12-05 21:20 UTC (permalink / raw)
  To: linux-block, kernel-team, mpa, nbd-general

While doing stress tests we noticed that we'd get a lot of dmesg spam if
we suddenly disconnected teh nbd device out of band.  Rate limite the
messages in the io path in order to deal with this.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 drivers/block/nbd.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index bc78cbb..0e6e52df 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -219,7 +219,7 @@ static int sock_xmit(struct nbd_device *nbd, int index, int send, void *buf,
 	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;
@@ -302,7 +302,7 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index)
 	result = sock_xmit(nbd, index, 1, &request, sizeof(request),
 			(type == NBD_CMD_WRITE) ? MSG_MORE : 0);
 	if (result <= 0) {
-		dev_err(disk_to_dev(nbd->disk),
+		dev_err_ratelimited(disk_to_dev(nbd->disk),
 			"Send control failed (result %d)\n", result);
 		return -EIO;
 	}
@@ -501,14 +501,14 @@ static void nbd_handle_cmd(struct nbd_cmd *cmd, int index)
 	struct nbd_sock *nsock;
 
 	if (index >= nbd->num_connections) {
-		dev_err(disk_to_dev(nbd->disk),
-			"Attempted send on invalid socket\n");
+		dev_err_ratelimited(disk_to_dev(nbd->disk),
+				    "Attempted send on invalid socket\n");
 		goto error_out;
 	}
 
 	if (test_bit(NBD_DISCONNECTED, &nbd->runtime_flags)) {
-		dev_err(disk_to_dev(nbd->disk),
-			"Attempted send on closed socket\n");
+		dev_err_ratelimited(disk_to_dev(nbd->disk),
+				    "Attempted send on closed socket\n");
 		goto error_out;
 	}
 
@@ -519,8 +519,8 @@ static void nbd_handle_cmd(struct nbd_cmd *cmd, int index)
 	if (req->cmd_type == REQ_TYPE_FS &&
 	    rq_data_dir(req) == WRITE &&
 	    (nbd->flags & NBD_FLAG_READ_ONLY)) {
-		dev_err(disk_to_dev(nbd->disk),
-			"Write on read-only\n");
+		dev_err_ratelimited(disk_to_dev(nbd->disk),
+				    "Write on read-only\n");
 		goto error_out;
 	}
 
@@ -530,13 +530,14 @@ static void nbd_handle_cmd(struct nbd_cmd *cmd, int index)
 	mutex_lock(&nsock->tx_lock);
 	if (unlikely(!nsock->sock)) {
 		mutex_unlock(&nsock->tx_lock);
-		dev_err(disk_to_dev(nbd->disk),
-			"Attempted send on closed socket\n");
+		dev_err_ratelimited(disk_to_dev(nbd->disk),
+				    "Attempted send on closed socket\n");
 		goto error_out;
 	}
 
 	if (nbd_send_cmd(nbd, cmd, index) != 0) {
-		dev_err(disk_to_dev(nbd->disk), "Request send failed\n");
+		dev_err_ratelimited(disk_to_dev(nbd->disk),
+				    "Request send failed\n");
 		req->errors++;
 		nbd_end_request(cmd);
 	}
-- 
2.5.5


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

* Re: [Nbd] [PATCH] nbd: use dev_err_ratelimited in io path
  2016-12-05 21:20 [PATCH] nbd: use dev_err_ratelimited in io path Josef Bacik
@ 2016-12-05 21:27 ` Eric Blake
  2016-12-05 21:34   ` Josef Bacik
  2016-12-08 22:28 ` Jens Axboe
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Blake @ 2016-12-05 21:27 UTC (permalink / raw)
  To: Josef Bacik, linux-block, kernel-team, mpa, nbd-general


[-- Attachment #1.1: Type: text/plain, Size: 560 bytes --]

On 12/05/2016 03:20 PM, Josef Bacik wrote:
> While doing stress tests we noticed that we'd get a lot of dmesg spam if
> we suddenly disconnected teh nbd device out of band.  Rate limite the

s/teh/the/
s/limite/limit/

> messages in the io path in order to deal with this.
> 
> Signed-off-by: Josef Bacik <jbacik@fb.com>
> ---
>  drivers/block/nbd.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Nbd] [PATCH] nbd: use dev_err_ratelimited in io path
  2016-12-05 21:27 ` [Nbd] " Eric Blake
@ 2016-12-05 21:34   ` Josef Bacik
  0 siblings, 0 replies; 4+ messages in thread
From: Josef Bacik @ 2016-12-05 21:34 UTC (permalink / raw)
  To: Eric Blake; +Cc: linux-block, kernel-team, mpa, nbd-general

On Mon, Dec 5, 2016 at 4:27 PM, Eric Blake <eblake@redhat.com> wrote:
> On 12/05/2016 03:20 PM, Josef Bacik wrote:
>>  While doing stress tests we noticed that we'd get a lot of dmesg 
>> spam if
>>  we suddenly disconnected teh nbd device out of band.  Rate limite 
>> the
> 
> s/teh/the/
> s/limite/limit/

Thanks, I've updated my .vimrc to have spell check for git commits,

Josef


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

* Re: [PATCH] nbd: use dev_err_ratelimited in io path
  2016-12-05 21:20 [PATCH] nbd: use dev_err_ratelimited in io path Josef Bacik
  2016-12-05 21:27 ` [Nbd] " Eric Blake
@ 2016-12-08 22:28 ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2016-12-08 22:28 UTC (permalink / raw)
  To: Josef Bacik, linux-block, kernel-team, mpa, nbd-general

On 12/05/2016 02:20 PM, Josef Bacik wrote:
> While doing stress tests we noticed that we'd get a lot of dmesg spam if
> we suddenly disconnected teh nbd device out of band.  Rate limite the
> messages in the io path in order to deal with this.

Added, with fixed up spelling.

-- 
Jens Axboe


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

end of thread, other threads:[~2016-12-08 22:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-05 21:20 [PATCH] nbd: use dev_err_ratelimited in io path Josef Bacik
2016-12-05 21:27 ` [Nbd] " Eric Blake
2016-12-05 21:34   ` Josef Bacik
2016-12-08 22:28 ` Jens Axboe

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).