Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4610985rdb; Fri, 15 Sep 2023 07:23:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/84BuGCuvtLWPnWQtXSrqsksfDtvwcVrf+A9WIU4zg8EbCNM73w6zmst82Oi1KM66Lv0C X-Received: by 2002:a17:90b:386:b0:268:1be1:745a with SMTP id ga6-20020a17090b038600b002681be1745amr1425785pjb.29.1694787816737; Fri, 15 Sep 2023 07:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694787816; cv=none; d=google.com; s=arc-20160816; b=W4xu1aMpyK5aMWT9Kut3kHfmBQF+Q4WXYC15lHVtFesix0OMWSrcelZT1lpI5B5sdG wTeYHp/dp9pietUQijcQV/PsbWFfEwBM94smDtJ8Vcw7QzA8Rz9zvcrxBVPodBoPefE3 y+XGSoxuC3cpIB0dhJgSiOo/LPb8jRwgwuoBJ+5FtONZAKBSSzqLnFpwgIs10LPJDpNA 1fhXeuGMpNApw9kGd5aGf7fDGPP69Sim0ZcGelT5BCD/hvOoO1iHAwfQDXw+PRb7cORt eDm+RSDAwnaoBaI2DrKxGN8x0zieczR1hg+CE9A4+TgcscRNWnNy7DK8fIyHBxOf67W4 og7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=oYtmGG6qL/zG4tahuBG2Sq+on0Fe6qbc1wsa4F9iPKk=; fh=S9Y58MVSRnyJnbq1evQJcOQKxMGtKPO1jadlqy3WltQ=; b=hX7wKfswhCOiSX+hg0bFHai/m6CQCc62/VsIsJ5Q0RObRL25EzFEISpHospalB67zA MB9edhh6RK4z58uhCf7wP7/Z/o13e0If0TsFVOGwmrk2drxO9Ud+lgDdqczv63AA5qCi 27kaKf4gxY88khwxjiJhCXlwd6RVSO/9FprsNbFGuOrvpOEvwZQQdytwpjBSLu3rczdz LrmO7hmSp+thFey/ZdYtiN+mn6Fhdudoo79738/s/lojI8F1ETh9et7vG4O33e+Z67+l 2NTrlxH6o0g1yc6+DjgAXyyWIUmyZLvVjqKRAJxok7JpebZC4TXDzmYXDWN/CraWpBpO vSJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AkNLur5s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id e5-20020a17090a804500b002681dc4472esi5461963pjw.134.2023.09.15.07.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:23:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AkNLur5s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id ECE7A82AC7B8; Thu, 14 Sep 2023 20:06:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231792AbjIODGs (ORCPT + 99 others); Thu, 14 Sep 2023 23:06:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229767AbjIODGr (ORCPT ); Thu, 14 Sep 2023 23:06:47 -0400 Received: from mail-vk1-xa2d.google.com (mail-vk1-xa2d.google.com [IPv6:2607:f8b0:4864:20::a2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C46FA270A; Thu, 14 Sep 2023 20:06:43 -0700 (PDT) Received: by mail-vk1-xa2d.google.com with SMTP id 71dfb90a1353d-495f20c5832so672325e0c.0; Thu, 14 Sep 2023 20:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694747203; x=1695352003; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oYtmGG6qL/zG4tahuBG2Sq+on0Fe6qbc1wsa4F9iPKk=; b=AkNLur5sXWUQ6BmzfG7L1n/bqy1lTlERiK8kBrPerF37bNT1lMTSj6kp13ASESDfh9 0xno+AXU3lJgy+qWE/hQXZMZXFEtjzPBvPw163xuXVAe7hE5o3QY3Y6VrYRZOChbZ7fw XKn02btuZDsTKbwqLs6m1M5/vCrZ6kccdQLvfb77YWjdIltfZlyGxsD5Crqgv6mj2Sr/ dL7Utepivn0ffV7I1PNzSEp3W7bovzmxeaWyL4aLMZ3ojYmpnX9f/pO1W7YhsUUEKUJr 2CPI+ddpb3rR0zHEY+ART/goTuJZz8mIZmeufc2oWLIgTrx93v8r7aiemsiMaM70GTN3 OV/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694747203; x=1695352003; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oYtmGG6qL/zG4tahuBG2Sq+on0Fe6qbc1wsa4F9iPKk=; b=HgF2pXuszv4qkmda7iI7KpCf9bWl2Z2u0LPxlbIUukJ2Lhk4eltocp6XwAGiIYeXmI 9tKg7TUYmH9sTOMaMTQ5IZcyJvLJyjtQ5VYuei/N6gQ+e2UuHd2+6oJz9CvTK+2uwxR/ PmdaaSRHIQWNk8tPzZkS8Sj5sYI6D7n6E+sh66C0CqJktX/Z5Xo+kY4giwTSIxeOTVRN P1P7kkr45J58fnOK2RWgeG1cvn5VOG86hpFaHRh1JIlEJnhVAm3TO7dpi1t3qgdA51FV N1J/aUlCvhEUsyVEyn5Zf8nOsH/3WCNEaFeD53D1uj1SSJt/OaxGxEq1UkcOutGh8c2p b1MQ== X-Gm-Message-State: AOJu0YyFSN/mWBr0foXyCivwkT8udv3WOXNXbKo0D3W9F9UVwvAz/Ae5 p4MU22iWkj94p93hkmZpBy7KUFS22EYZt+ZucYQ= X-Received: by 2002:a1f:eb82:0:b0:493:5363:d1dc with SMTP id j124-20020a1feb82000000b004935363d1dcmr576225vkh.12.1694747202792; Thu, 14 Sep 2023 20:06:42 -0700 (PDT) MIME-Version: 1.0 References: <20230913152238.905247-1-mszeredi@redhat.com> <904a8d17-b6df-e294-fcf6-6f95459e1ffa@themaw.net> In-Reply-To: <904a8d17-b6df-e294-fcf6-6f95459e1ffa@themaw.net> From: Amir Goldstein Date: Fri, 15 Sep 2023 06:06:31 +0300 Message-ID: Subject: Re: [RFC PATCH 0/3] quering mount attributes To: Ian Kent Cc: Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-man@vger.kernel.org, linux-security-module@vger.kernel.org, Karel Zak , David Howells , Linus Torvalds , Al Viro , Christian Brauner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 14 Sep 2023 20:06:59 -0700 (PDT) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email On Fri, Sep 15, 2023 at 4:20=E2=80=AFAM Ian Kent wrote: > > On 14/9/23 14:47, Amir Goldstein wrote: > > On Wed, Sep 13, 2023 at 6:22=E2=80=AFPM Miklos Szeredi wrote: > >> Implement the mount querying syscalls agreed on at LSF/MM 2023. This = is an > >> RFC with just x86_64 syscalls. > >> > >> Excepting notification this should allow full replacement for > >> parsing /proc/self/mountinfo. > > Since you mentioned notifications, I will add that the plan discussed > > in LFSMM was, once we have an API to query mount stats and children, > > implement fanotify events for: > > mount [mntuid] was un/mounted at [parent mntuid],[dirfid+name] > > > > As with other fanotify events, the self mntuid and dirfid+name > > information can be omitted and without it, multiple un/mount events > > from the same parent mntuid will be merged, allowing userspace > > to listmnt() periodically only mntuid whose child mounts have changed, > > with little risk of event queue overflow. > > > > The possible monitoring scopes would be the entire mount namespace > > of the monitoring program or watching a single mount for change in > > its children mounts. The latter is similar to inotify directory childre= n watch, > > where the watches needs to be set recursively, with all the weight on > > userspace to avoid races. > > It's been my belief that the existing notification mechanisms don't > quite fully satisfy the needs of users of these calls (aka. the need > I found when implementing David's original calls into systemd). > > Specifically the ability to process a batch of notifications at once. > > Admittedly the notifications mechanism that David originally implemented > didn't fully implement what I found I needed but it did provide for a > settable queue length and getting a batch of notifications at a time. > > Am I mistaken in my belief? > I am not sure I understand the question. fanotify has an event queue (16K events by default), but it can also use unlimited size. With a limited size queue, event queue overflow generates an overflow event. event listeners can read a batch of events, depending on the size of the buffer that they provide. when multiple events with same information are queued, for example "something was un/mounted over parent mntuid 100" fanotify will merged those all those events in the queue and the event listeners will get only one such event in the batch. > Don't misunderstand me, it would be great for the existing notification > mechanisms to support these system calls, I just have a specific use case > in mind that I think is important, at least to me. > Please explain the use case and your belief about existing fanotify limitations. I did not understand it. Thanks, Amir.