From patchwork Sat Dec 23 06:50:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keqi Wang X-Patchwork-Id: 182933 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1523803dyi; Fri, 22 Dec 2023 22:51:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9sDRfZ8ZXOKpcg9RZt7eXYIy8eToz5anuwZFvdioLO3tLZg0+iNQoq9yB0wDSepwzpsou X-Received: by 2002:a05:6808:188e:b0:3bb:7549:8d89 with SMTP id bi14-20020a056808188e00b003bb75498d89mr3143558oib.25.1703314316231; Fri, 22 Dec 2023 22:51:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703314316; cv=none; d=google.com; s=arc-20160816; b=03XKdhzXssrEXJFO7gIgSXaITa4UBMyzfcQTXXHtXVNcg3+69apA7YTxLoxD2Pb+wk bv9wL5mzPE2Ryc7X3WW7PZyKzVlMl5sP6Vv5qw6WkB3/UdY1kl9y97k34ys4CLdqlgR1 9jIb7dM+12/c2nDPtatNBeqCaZVOvY+ffP0gDTWIW+go6QRn/iSLGv3c/yy6DPpmu46M T75SdH74ZHM/4r98RAW/afyrpB9z/6dbW6fay2uBRNxMFpax6aNB9ZWpH8lb+tPPJCsC aGNfG3n+Z1lVFXGJn8Tl8gHbiXx8iN/sHuIsUdK5rYtDJTvZjJ49jYjO+pCV5v8f4QsN 4p/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=vOQW7eM1tXoOjk7SXdvzeBTeJxvvs01bGEkLMLHzGlM=; fh=gTdt6wyrmnE7vVEv9VEvA5XV79VU7zgavD+PK7iZgro=; b=0UBQdj1JZYk5HBcWY6/YcMEHfRkSJcZcjRI0zSMnRGvLW7SFecM+bEqSMp7phe/iu3 fFLpmcd1TDM3lelpa1GuV62XXbwDg9epmu7UmhjcoS2BY0X6TZSRlc0ilL7xFiGNmHBq fUggdA0sc5O97E2lMFdLG0zFD5FEQiBh/3G8djGmQLQdP9/JqzBJ1zOWjQ323Qnc4h49 6XsWmWc4JF3WCVunGLQtHzOrS8eYIA+fhTQTrC399ljRwiv3G538oNnFHVtfvsH7ar8C VS6LMMsu3lEf0+g9gD/k+ZEShdQ6f5P2RWD9N9hWm9AxfutCTO63sa0skfMhoi0Njv5z fqzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=fq9ZAJdV; spf=pass (google.com: domain of linux-kernel+bounces-10326-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10326-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id cw26-20020a056a00451a00b006d287b8d34csi449857pfb.204.2023.12.22.22.51.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 22:51:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10326-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=fq9ZAJdV; spf=pass (google.com: domain of linux-kernel+bounces-10326-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10326-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 54233B2147D for ; Sat, 23 Dec 2023 06:51:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 83B6A8C07; Sat, 23 Dec 2023 06:51:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="fq9ZAJdV" X-Original-To: linux-kernel@vger.kernel.org Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.196]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B84C59440; Sat, 23 Dec 2023 06:51:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=vOQW7 eM1tXoOjk7SXdvzeBTeJxvvs01bGEkLMLHzGlM=; b=fq9ZAJdVBLs2TEdvyWkE0 g0eWgruRMKOKe2oYEZaTWgRw1gVQ0Ei51CyupvPQDrcW9gRibFxRXJWK5W/eLVlw Hm7A8Mqp8RU4FjDVJIsa7McLmvVPy6ANlwq4vfkjavOLYMkNKztbKCfS7TZWubDC HTN1InDfPTHDN8ZdZ2DwMY= Received: from localhost.localdomain (unknown [111.202.47.2]) by zwqz-smtp-mta-g4-2 (Coremail) with SMTP id _____wD3n6RYg4ZlvWoXBA--.33533S2; Sat, 23 Dec 2023 14:51:04 +0800 (CST) From: wangkeqi To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, wangkeqi Subject: [PATCH] connector: Fix proc_event_num_listeners count not cleared Date: Sat, 23 Dec 2023 14:50:32 +0800 Message-Id: <20231223065032.20498-1-wangkeqi_chris@163.com> X-Mailer: git-send-email 2.27.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: _____wD3n6RYg4ZlvWoXBA--.33533S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7XFykGrWkAw4xKFyfJFWUurg_yoW8JrWfpF ZrurWjyF48XayxWwn8JF4j9FyrXaykXry2kF4xG3sxWrn8WrZ2qF4rtFZF9a43J348Kr1Y vw1qqF98uan8CaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jSjgxUUUUU= X-CM-SenderInfo: 5zdqwy5htlsupkul2qqrwthudrp/1tbiQBxP3GVOAnnTogAAsu X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786054512391361576 X-GMAIL-MSGID: 1786054512391361576 From: wangkeqi When we register a cn_proc listening event, the proc_event_num_listener variable will be incremented by one, but if PROC_CN_MCAST_IGNORE is not called, the count will not decrease. This will cause the proc_*_connector function to take the wrong path. It will reappear when the forkstat tool exits via ctrl + c. We solve this problem by determining whether there are still listeners to clear proc_event_num_listener. Signed-off-by: wangkeqi --- drivers/connector/cn_proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index 44b19e696..3d5e6d705 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c @@ -108,8 +108,9 @@ static inline void send_msg(struct cn_msg *msg) filter_data[1] = 0; } - cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, - cn_filter, (void *)filter_data); + if (cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, + cn_filter, (void *)filter_data) == -ESRCH) + atomic_set(&proc_event_num_listeners, 0); local_unlock(&local_event.lock); }