Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3842485iog; Tue, 28 Jun 2022 04:04:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t6SgknoUjBLYuwPV28aXmHKfe7cOjORPf9mmnm4TN7BmOst0BO7zmD0A1YyZSmcS3rruXr X-Received: by 2002:a05:6402:4248:b0:435:9150:ccfb with SMTP id g8-20020a056402424800b004359150ccfbmr22513163edb.374.1656414244280; Tue, 28 Jun 2022 04:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656414244; cv=none; d=google.com; s=arc-20160816; b=Kw7aVQ9Zk9vLsE5BU/X6hN8et0q5zKQDTWwQ0VvSRzLjueESFw2AfGwhqZQL3356mh G9+xxa7LXKVp1vxhFVSqsxV5WCGUdckFLex8HwDxx86ssjvjcRGGOWsBJ0mhyFeqMcjT 85PgDMPbAVPPLbDF152j0x7Amjd8tlVSH0SDOLuNqEhqFo8wHvWFEqZ/iYwrSNKe3J9c 1EyuOZRDUypDxDtpR6seWwXa7vFYPhwgnGdWIAnuKSTYN6/20gvutmVB9pn9tZtrEber kuCynWk17wf56bkiyabn+cDa4ocaK9mbXfVm3EqSaFnqOfLyMXsnYRquPcuobTRNNnxu WonA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=O0nt2J5ePcRV7nkaFA0OV/T6zQxmOqrbqRciI67/u2Q=; b=JrLYgboyiVnOyOH6aAm/QwplxVLwA6ci7JnEMsw0T/ru8KZVonKyXHIY28JSxGM56v Mc1EHL5uangokfWgYelSX2+BcJeSZfm/7YuReH64vhHpo3NmbguuG87eqXrQQfGsXTJ5 jbLj7ZwU8e6jBWAkq0ZraSidPekU574nuN8dYWGuiA5jYsMsilekUrgBYqDBjQP59ecV pkHl2ANdWdiGyW8uGmCV499c9V8PpjxiGNwquInP56bD0a1kBqEUPsOKaYWf1gWkkIA+ 6XiRoeQDhPRhddq9qYaaCckVNTx5H4bDT9wgxl+YloIDGIGAwaBrPg+vl7hHcE7xytf0 y9yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="cjo/ofZK"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd20-20020a1709076e1400b00711da52c6e4si18192243ejc.309.2022.06.28.04.03.37; Tue, 28 Jun 2022 04:04:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="cjo/ofZK"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343551AbiF1Kpc (ORCPT + 99 others); Tue, 28 Jun 2022 06:45:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234570AbiF1Kpb (ORCPT ); Tue, 28 Jun 2022 06:45:31 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 319D031371; Tue, 28 Jun 2022 03:45:30 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D8D1A1FA12; Tue, 28 Jun 2022 10:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1656413128; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O0nt2J5ePcRV7nkaFA0OV/T6zQxmOqrbqRciI67/u2Q=; b=cjo/ofZKs9v9HXQskNf/9FY0eqNF0c6Sk8dQv7JicBnP9u5FUHKJRTduoByCU49b6b81E+ J0w/eIhlkd/q1S9xeNY3Q4quxyHwl479Bqgq1gQ60bd9N4zgI+mX3xSNYjQYpaLHDDdamP D5oUz4Sf/PEMLFKyBzPSZ4oJ4dDfzT8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1656413128; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O0nt2J5ePcRV7nkaFA0OV/T6zQxmOqrbqRciI67/u2Q=; b=NIiPhwCUaumeJpV+tRv9qaxMJE7PD/ZW7e6ORLFYG0zuZmLhsngAZLg0cHPi1ZXbjaE1zr /B3814+aiuSxr9BQ== Received: from quack3.suse.cz (dhcp194.suse.cz [10.100.51.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 8D2042C141; Tue, 28 Jun 2022 10:45:28 +0000 (UTC) Received: by quack3.suse.cz (Postfix, from userid 1000) id 68E24A062F; Tue, 28 Jun 2022 12:45:28 +0200 (CEST) Date: Tue, 28 Jun 2022 12:45:28 +0200 From: Jan Kara To: Guowei Du Cc: jack@suse.cz, amir73il@gmail.com, repnop@google.com, brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, duguowei Subject: Re: [PATCH 6/6] fanotify: add current_user_instances node Message-ID: <20220628104528.no4jarh2ihm5gxau@quack3> References: <20220628101413.10432-1-duguoweisz@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220628101413.10432-1-duguoweisz@gmail.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 28-06-22 18:14:13, Guowei Du wrote: > From: duguowei > > Add a node of sysctl, which is current_user_instances. > It shows current initialized group counts of system. > > Signed-off-by: duguowei Hum, I'm not sure about a wider context here but the changelog is certainly missing a motivation of this change - why do you need this counter? In particular because we already do maintain (and limit) the number of fanotify groups each user has allocated in a particular namespace... Honza > --- > fs/notify/fanotify/fanotify_user.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c > index c2255b440df9..39674fbffc4f 100644 > --- a/fs/notify/fanotify/fanotify_user.c > +++ b/fs/notify/fanotify/fanotify_user.c > @@ -51,6 +51,8 @@ > > /* configurable via /proc/sys/fs/fanotify/ */ > static int fanotify_max_queued_events __read_mostly; > +/* current initialized group count */ > +static int fanotify_user_instances __read_mostly; > > #ifdef CONFIG_SYSCTL > > @@ -86,6 +88,14 @@ static struct ctl_table fanotify_table[] = { > .proc_handler = proc_dointvec_minmax, > .extra1 = SYSCTL_ZERO > }, > + { > + .procname = "current_user_instances", > + .data = &fanotify_user_instances, > + .maxlen = sizeof(int), > + .mode = 0444, > + .proc_handler = proc_dointvec_minmax, > + .extra1 = SYSCTL_ZERO > + }, > { } > }; > > @@ -905,6 +915,8 @@ static int fanotify_release(struct inode *ignored, struct file *file) > /* matches the fanotify_init->fsnotify_alloc_group */ > fsnotify_destroy_group(group); > > + fanotify_user_instances--; > + > return 0; > } > > @@ -1459,6 +1471,8 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) > if (fd < 0) > goto out_destroy_group; > > + fanotify_user_instances++; > + > return fd; > > out_destroy_group: > -- > 2.36.1 > -- Jan Kara SUSE Labs, CR