From 7462e8cad730897f459da31886c57585654f26b8 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sat, 7 Nov 2020 00:53:28 -0700 Subject: [PATCH] LU-930 misc: limit CDEBUG console message frequency 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. Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I9081398c7d014b2873e764dc283ce2f4623ebbe5 Reviewed-on: https://review.whamcloud.com/40571 Tested-by: jenkins Reviewed-by: Arshad Hussain Tested-by: Maloo Reviewed-by: Wang Shilong Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 5 +++-- lustre/lod/lod_object.c | 31 ++++++++++++++-------------- lustre/lov/lov_obd.c | 10 ++++----- lustre/mdt/mdt_handler.c | 8 ++++---- lustre/ptlrpc/client.c | 8 ++++---- lustre/ptlrpc/events.c | 53 ++++++++++++++++++++++++------------------------ lustre/ptlrpc/import.c | 2 +- 7 files changed, 58 insertions(+), 59 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index bdeac63..3871c89 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -324,8 +324,9 @@ static int ll_md_close(struct inode *inode, struct file *file) /* Usually the lease is not released when the * 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/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 017d389..a1cdfc7 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -920,13 +920,12 @@ int lod_load_lmv_shards(const struct lu_env *env, struct lod_object *lo, /* The ent->lde_name is composed of ${FID}:${index} */ if (ent->lde_namelen < len + 1 || memcmp(ent->lde_name, name, len) != 0) { - CDEBUG(lod->lod_lmv_failout ? D_ERROR : D_INFO, - "%s: invalid shard name %.*s with the FID "DFID - " for the striped directory "DFID", %s\n", - lod2obd(lod)->obd_name, ent->lde_namelen, - ent->lde_name, PFID(&fid), - PFID(lu_object_fid(&obj->do_lu)), - lod->lod_lmv_failout ? "failout" : "skip"); + CDEBUG_LIMIT(lod->lod_lmv_failout ? D_ERROR : D_INFO, + "%s: invalid shard name %.*s with the FID "DFID" for the striped directory "DFID", %s\n", + lod2obd(lod)->obd_name, ent->lde_namelen, + ent->lde_name, PFID(&fid), + PFID(lu_object_fid(&obj->do_lu)), + lod->lod_lmv_failout ? "failout" : "skip"); if (lod->lod_lmv_failout) break; @@ -938,15 +937,15 @@ int lod_load_lmv_shards(const struct lu_env *env, struct lod_object *lo, do { if (ent->lde_name[len] < '0' || ent->lde_name[len] > '9') { - CDEBUG(lod->lod_lmv_failout ? D_ERROR : D_INFO, - "%s: invalid shard name %.*s with the " - "FID "DFID" for the striped directory " - DFID", %s\n", - lod2obd(lod)->obd_name, ent->lde_namelen, - ent->lde_name, PFID(&fid), - PFID(lu_object_fid(&obj->do_lu)), - lod->lod_lmv_failout ? - "failout" : "skip"); + CDEBUG_LIMIT(lod->lod_lmv_failout ? + D_ERROR : D_INFO, + "%s: invalid shard name %.*s with the FID "DFID" for the striped directory "DFID", %s\n", + lod2obd(lod)->obd_name, + ent->lde_namelen, + ent->lde_name, PFID(&fid), + PFID(lu_object_fid(&obj->do_lu)), + lod->lod_lmv_failout ? + "failout" : "skip"); if (lod->lod_lmv_failout) break; diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 79fe4c9..cd3be35 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -1067,11 +1067,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/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index e8d9582..bf1d0d7 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1416,10 +1416,10 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, rc = mdt_attr_get_complex(info, o, ma); if (unlikely(rc)) { - CDEBUG(rc == -ENOENT ? D_OTHER : D_ERROR, - "%s: getattr error for "DFID": rc = %d\n", - mdt_obd_name(info->mti_mdt), - PFID(mdt_object_fid(o)), rc); + CDEBUG_LIMIT(rc == -ENOENT ? D_OTHER : D_ERROR, + "%s: getattr error for "DFID": rc = %d\n", + mdt_obd_name(info->mti_mdt), + PFID(mdt_object_fid(o)), rc); RETURN(rc); } diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 71174f8..aacfb39 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -406,10 +406,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/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index 8d569a7..ff8f883 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -203,15 +203,15 @@ void client_bulk_callback(struct lnet_event *ev) ev->type == LNET_EVENT_UNLINK); LASSERT(ev->unlinked); - if (CFS_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_CLIENT_BULK_CB, CFS_FAIL_ONCE)) - ev->status = -EIO; + if (CFS_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_CLIENT_BULK_CB, CFS_FAIL_ONCE)) + ev->status = -EIO; - if (CFS_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_CLIENT_BULK_CB2,CFS_FAIL_ONCE)) - ev->status = -EIO; + if (CFS_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_CLIENT_BULK_CB2,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; @@ -314,24 +314,23 @@ 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 - * request buffer we can use the request object embedded in - * rqbd. Note that if we failed to allocate a request, - * we'd have to re-post the rqbd, which we can't do in this - * context. */ - req = &rqbd->rqbd_req; - memset(req, 0, sizeof (*req)); - } else { - LASSERT (ev->type == LNET_EVENT_PUT); - if (ev->status != 0) { - /* We moaned above already... */ - return; - } + if (ev->unlinked) { + /* If this is the last request message to fit in the + * request buffer we can use the request object embedded in + * rqbd. Note that if we failed to allocate a request, + * we'd have to re-post the rqbd, which we can't do in this + * context. + */ + req = &rqbd->rqbd_req; + memset(req, 0, sizeof(*req)); + } else { + LASSERT(ev->type == LNET_EVENT_PUT); + if (ev->status != 0) /* We moaned above already... */ + return; req = ptlrpc_request_cache_alloc(GFP_ATOMIC); if (req == NULL) { CERROR("Can't allocate incoming request descriptor: " @@ -459,9 +458,9 @@ void server_bulk_callback(struct lnet_event *ev) (ptlrpc_is_bulk_get_sink(desc->bd_type) && ev->type == LNET_EVENT_REPLY)); - 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); diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index beb67b3..26d7b98 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -1213,7 +1213,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, * with server again */ if ((MSG_CONNECT_RECOVERING & msg_flags)) { - CDEBUG(level, + CDEBUG_LIMIT(level, "%s@%s changed server handle from " "%#llx to %#llx" " but is still in recovery\n", -- 1.8.3.1