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 <[email protected]>
---
 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


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Nbd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nbd-general

Reply via email to