linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shradha Gupta <shradhagupta@linux.microsoft.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	Naman Jain <namjain@linux.microsoft.com>,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Shradha Gupta <shradhagupta@linux.microsoft.com>,
	Shradha Gupta <shradhagupta@microsoft.com>
Subject: [PATCH] hv/hv_kvp_daemon: Prevent similar logs in kvp_key_add_or_modify()
Date: Wed, 18 Jun 2025 22:26:01 -0700	[thread overview]
Message-ID: <1750310761-13302-1-git-send-email-shradhagupta@linux.microsoft.com> (raw)

When hv_kvp_daemon is started in debug mode, in function
kvp_key_add_or_modify() too many similar logs are logged for
key/value being too long.

Restructured the logs to prevent this extra logging

Suggested-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
---
 tools/hv/hv_kvp_daemon.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 1f64c680be13..91a708282358 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -352,21 +352,17 @@ static int kvp_key_add_or_modify(int pool, const __u8 *key, int key_size,
 	int num_blocks;
 	int i;
 
-	if (debug)
-		syslog(LOG_DEBUG, "%s: got a KVP: pool=%d key=%s val=%s",
-		       __func__, pool, key, value);
-
 	if ((key_size > HV_KVP_EXCHANGE_MAX_KEY_SIZE) ||
 		(value_size > HV_KVP_EXCHANGE_MAX_VALUE_SIZE)) {
-		syslog(LOG_ERR, "%s: Too long key or value: key=%s, val=%s",
-		       __func__, key, value);
-
-		if (debug)
-			syslog(LOG_DEBUG, "%s: Too long key or value: pool=%d, key=%s, val=%s",
-			       __func__, pool, key, value);
+		syslog(LOG_ERR, "%s: Too long key or value: pool=%d key=%s, val=%s",
+		       __func__, pool, key, value);
 		return 1;
 	}
 
+	if (debug)
+		syslog(LOG_DEBUG, "%s: got a KVP: pool=%d key=%s val=%s",
+		       __func__, pool, key, value);
+
 	/*
 	 * First update the in-memory state.
 	 */

base-commit: 4325743c7e209ae7845293679a4de94b969f2bef
-- 
2.34.1


             reply	other threads:[~2025-06-19  5:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19  5:26 Shradha Gupta [this message]
2025-07-09 22:45 ` [PATCH] hv/hv_kvp_daemon: Prevent similar logs in kvp_key_add_or_modify() Wei Liu

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=1750310761-13302-1-git-send-email-shradhagupta@linux.microsoft.com \
    --to=shradhagupta@linux.microsoft.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjain@linux.microsoft.com \
    --cc=shradhagupta@microsoft.com \
    --cc=wei.liu@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).