[lustre-devel] [PATCH 25/29] lustre: misc: limit CDEBUG console message frequency

James Simmons jsimmons at infradead.org
Sun Apr 25 13:08:32 PDT 2021


From: Andreas Dilger <adilger at whamcloud.com>

Some CDEBUG() messages have variable message levels, but if printed
to the console it is not rate limited like CWARN() and CERROR():

server_bulk_callback()) event type 5, status -110
server_bulk_callback()) event type 5, status -110
server_bulk_callback()) event type 5, status -110
:

Instead, use CDEBUG_LIMIT() for those messages to limit them.

WC-bug-id: https://jira.whamcloud.com/browse/LU-930
Lustre-commit: 7462e8cad730897f4 ("LU-930 misc: limit CDEBUG console message frequency")
Signed-off-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/40571
Reviewed-by: Arshad Hussain <arshad.hussain at aeoncomputing.com>
Reviewed-by: Wang Shilong <wshilong at whamcloud.com>
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/llite/file.c    |  6 +++---
 fs/lustre/lov/lov_obd.c   | 10 +++++-----
 fs/lustre/ptlrpc/client.c |  8 ++++----
 fs/lustre/ptlrpc/events.c | 16 +++++++---------
 4 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index c049433..15072bb1 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -329,9 +329,9 @@ static int ll_md_close(struct inode *inode, struct file *file)
 		 * application crashed, we need to release here.
 		 */
 		rc = ll_lease_close(fd->fd_lease_och, inode, &lease_broken);
-		CDEBUG(rc ? D_ERROR : D_INODE,
-		       "Clean up lease " DFID " %d/%d\n",
-		       PFID(&lli->lli_fid), rc, lease_broken);
+		CDEBUG_LIMIT(rc ? D_ERROR : D_INODE,
+			     "Clean up lease " DFID " %d/%d\n",
+			     PFID(&lli->lli_fid), rc, lease_broken);
 
 		fd->fd_lease_och = NULL;
 	}
diff --git a/fs/lustre/lov/lov_obd.c b/fs/lustre/lov/lov_obd.c
index 29b0645..20e0be0 100644
--- a/fs/lustre/lov/lov_obd.c
+++ b/fs/lustre/lov/lov_obd.c
@@ -1081,11 +1081,11 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 					    len, karg, uarg);
 			if (err) {
 				if (lov->lov_tgts[i]->ltd_active) {
-					CDEBUG(err == -ENOTTY ?
-					       D_IOCTL : D_WARNING,
-					       "iocontrol OSC %s on OST idx %d cmd %x: err = %d\n",
-					       lov_uuid2str(lov, i),
-					       i, cmd, err);
+					CDEBUG_LIMIT(err == -ENOTTY ?
+						     D_IOCTL : D_WARNING,
+						     "iocontrol OSC %s on OST idx %d cmd %x: err = %d\n",
+						     lov_uuid2str(lov, i),
+						     i, cmd, err);
 					if (!rc)
 						rc = err;
 				}
diff --git a/fs/lustre/ptlrpc/client.c b/fs/lustre/ptlrpc/client.c
index 3c57b69..a818b01 100644
--- a/fs/lustre/ptlrpc/client.c
+++ b/fs/lustre/ptlrpc/client.c
@@ -378,10 +378,10 @@ void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req,
 		 * resent time, but server sent back service time of original
 		 * RPC.
 		 */
-		CDEBUG((lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) ?
-		       D_ADAPTTO : D_WARNING,
-		       "Reported service time %u > total measured time %lld\n",
-		       service_timeout, now - req->rq_sent);
+		CDEBUG_LIMIT((lustre_msg_get_flags(req->rq_reqmsg) &
+			      MSG_RESENT) ?  D_ADAPTTO : D_WARNING,
+			     "Reported service time %u > total measured time %lld\n",
+			     service_timeout, now - req->rq_sent);
 		return;
 	}
 
diff --git a/fs/lustre/ptlrpc/events.c b/fs/lustre/ptlrpc/events.c
index fe33600..e348e4a 100644
--- a/fs/lustre/ptlrpc/events.c
+++ b/fs/lustre/ptlrpc/events.c
@@ -203,9 +203,9 @@ void client_bulk_callback(struct lnet_event *ev)
 				 CFS_FAIL_ONCE))
 		ev->status = -EIO;
 
-	CDEBUG((ev->status == 0) ? D_NET : D_ERROR,
-	       "event type %d, status %d, desc %p\n",
-	       ev->type, ev->status, desc);
+	CDEBUG_LIMIT((ev->status == 0) ? D_NET : D_ERROR,
+		     "event type %d, status %d, desc %p\n",
+		     ev->type, ev->status, desc);
 
 	spin_lock(&desc->bd_lock);
 	req = desc->bd_req;
@@ -311,9 +311,9 @@ void request_in_callback(struct lnet_event *ev)
 	LASSERT((char *)ev->md_start + ev->offset + ev->mlength <=
 		rqbd->rqbd_buffer + service->srv_buf_size);
 
-	CDEBUG((ev->status == 0) ? D_NET : D_ERROR,
-	       "event type %d, status %d, service %s\n",
-	       ev->type, ev->status, service->srv_name);
+	CDEBUG_LIMIT((ev->status == 0) ? D_NET : D_ERROR,
+		     "event type %d, status %d, service %s\n",
+		     ev->type, ev->status, service->srv_name);
 
 	if (ev->unlinked) {
 		/* If this is the last request message to fit in the
@@ -326,10 +326,8 @@ void request_in_callback(struct lnet_event *ev)
 		memset(req, 0, sizeof(*req));
 	} else {
 		LASSERT(ev->type == LNET_EVENT_PUT);
-		if (ev->status != 0) {
-			/* We moaned above already... */
+		if (ev->status != 0) /* We moaned above already... */
 			return;
-		}
 		req = ptlrpc_request_cache_alloc(GFP_ATOMIC);
 		if (!req) {
 			CERROR("Can't allocate incoming request descriptor: Dropping %s RPC from %s\n",
-- 
1.8.3.1



More information about the lustre-devel mailing list