Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1758581ybb; Thu, 2 Apr 2020 06:53:34 -0700 (PDT) X-Google-Smtp-Source: APiQypK74gzB/swxQjW7ZmJSzayd7N91ZPGofvVKFJrTmRtIzYCgjCxlSsFYYR/YJvGA6drAKc8j X-Received: by 2002:a05:6830:1313:: with SMTP id p19mr2528054otq.179.1585835614673; Thu, 02 Apr 2020 06:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585835614; cv=none; d=google.com; s=arc-20160816; b=cDkbdvdqddP/dBwiabncfGA2gnLjxtkafwqO2C5wjeJCQ5THRbMt0nQ6MZzW/ltKcA ZKCOPnsSJQ5mwe3d2DysE2v4S7KdXssgXAtjPlgttCF/ovyuM0INvMJ1i8Thbz9+1yKu OkqGR7IW6t6QJQp4MNg+hftMasGwq6ayhjYIsZx6Y/ZlL/hae48yocrkoMj/AUMh9n5K fqL10zJo+4yrFBm4NZGXT0V5yJVbAAnNc8AEsEoqC/4PshqdeKEiqb8SzpfNh8GcI5CY 8Z0Y08pCTXpgLAtCvLSs4KLcgSC2voLHUlTHrS2jEq+iJepslrU9gIiBDvTXihZIOUGJ OPxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=38tDIv0KNYRGjWQpLV5pSNvP7JpdlyIKdGeo6UD55p0=; b=bKk9j9Ri0mobMr7BP2dyeBnlprLKG2q6KaxYVgkuNtRFU7pvkH4QsFE2IlKameQkYz dW9RDnVKrfoQcjrEGxv1Z0DxlK694We9aX6JdAVUmSuHrF+B+HVFHA9PmsTBqlRs6H8h kpkMBTICZOte2xEKah8of6Nkp9XvXOCIkxp718waGSy2cmRyHzkyjSivKXdLB2aLj9lE EubDDyRxAzKaxRvFiIA4CsLPgwaSzSMuZJnFMJqbPaumGXxbRZ+G6N9cyIdDuMN0zmt9 nc8i7y1gfRmyxk/HQ2pRtHe2Qd3nHyYEM4SJmI5nlDdYT+YQ3ogAsNVMo5yb6GLdjMmG JYIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=mHf1i89r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si2308659oog.74.2020.04.02.06.53.21; Thu, 02 Apr 2020 06:53:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=mHf1i89r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732245AbgDBNwb (ORCPT + 99 others); Thu, 2 Apr 2020 09:52:31 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:42938 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387656AbgDBNwa (ORCPT ); Thu, 2 Apr 2020 09:52:30 -0400 Received: by mail-ed1-f66.google.com with SMTP id cw6so4163294edb.9 for ; Thu, 02 Apr 2020 06:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=38tDIv0KNYRGjWQpLV5pSNvP7JpdlyIKdGeo6UD55p0=; b=mHf1i89rxwD/U2z1mjMQcSxAomeWc1se7NI0BXPkvalHMI/UmRHR8zxEzBwhHrRpie lfZPvoKsJex5e+99/6K6TY/U0Oi1q15Kr12GW6oIbLommTSuH7t+hSeQWFea4nTjlB3V 95kmrieGk5HvIN6/0NbisdyXcDbd6kLMkqZLw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=38tDIv0KNYRGjWQpLV5pSNvP7JpdlyIKdGeo6UD55p0=; b=B6cfQVkYjpXnFMiA7N5WV5xcb5lWPvNCz4qfEQt2WmoAqCVkacb8GBlQdPcevPYhiI wwSq2TEG7w4SPNLHJcERMRSZcJC/I1FOuRKegLuG9mLUcDjAUnRzFd6ku61Ax/LEW8Md 3rNOGQy9/9SmC2Y2a91J7X6qqI5U5B06UtIEre6Ql+gBOniYIqD0YeunAJ7oZq7uDkD/ L6RSXXXZqHz5ptPp4fP0U1lBs8ZlhYhSggiwxdcd1zdO0A1tmUaIillsTLP5vFExwPtD mp3pnawgBAN0Jb5jCz+qbng2qimaT92WRyFjoZEoOBxU4fOcDTqhuyqZby7flh4RrDWz iYFw== X-Gm-Message-State: AGi0PuaTRyR9DzCD6JNuh2h/Kas8FcI1Cg/pyCekeEewXdaimQiSd+2Y k4kGqCcpbLAkyRHnV7eXyxmPsmlVgFr1ZwRwe2Hbpw== X-Received: by 2002:a17:906:b351:: with SMTP id cd17mr3373636ejb.351.1585835548323; Thu, 02 Apr 2020 06:52:28 -0700 (PDT) MIME-Version: 1.0 References: <20200330211700.g7evnuvvjenq3fzm@wittgenstein> <1445647.1585576702@warthog.procyon.org.uk> <2418286.1585691572@warthog.procyon.org.uk> <20200401144109.GA29945@gardel-login> <2590640.1585757211@warthog.procyon.org.uk> <36e45eae8ad78f7b8889d9d03b8846e78d735d28.camel@themaw.net> In-Reply-To: <36e45eae8ad78f7b8889d9d03b8846e78d735d28.camel@themaw.net> From: Miklos Szeredi Date: Thu, 2 Apr 2020 15:52:16 +0200 Message-ID: Subject: Re: Upcoming: Notifications, FS notifications and fsinfo() To: Ian Kent Cc: David Howells , Lennart Poettering , Christian Brauner , Linus Torvalds , Al Viro , dray@redhat.com, Karel Zak , Miklos Szeredi , Steven Whitehouse , Jeff Layton , andres@anarazel.de, keyrings@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Aleksa Sarai Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 2, 2020 at 4:52 AM Ian Kent wrote: > > On Wed, 2020-04-01 at 18:40 +0200, Miklos Szeredi wrote: > > On Wed, Apr 1, 2020 at 6:07 PM David Howells > > wrote: > > > Miklos Szeredi wrote: > > > > > > > I've still not heard a convincing argument in favor of a syscall. > > > > > > From your own results, scanning 10000 mounts through mountfs and > > > reading just > > > two values from each is an order of magnitude slower without the > > > effect of the > > > dentry/inode caches. It gets faster on the second run because the > > > mountfs > > > dentries and inodes are cached - but at a cost of >205MiB of > > > RAM. And it's > > > *still* slower than fsinfo(). > > > > Already told you that we can just delete the dentry on dput_final, so > > the memory argument is immaterial. > > > > And the speed argument also, because there's no use case where that > > would make a difference. You keep bringing up the notification queue > > overrun when watching a subtree, but that's going to be painful with > > fsinfo(2) as well. If that's a relevant use case (not saying it's > > true), might as well add a /mnt/MNT_ID/subtree_info (trivial again) > > that contains all information for the subtree. Have fun implementing > > that with fsinfo(2). > > Forgive me for not trawling through your patch to work this out > but how does a poll on a path get what's needed to get mount info. > > Or, more specifically, how does one get what's needed to go directly > to the place to get mount info. when something in the tree under the > polled path changes (mount/umount). IIUC poll alone won't do subtree > change monitoring? The mechanisms are basically the same as with fsinfo(2). You can get to the mountfs entry through the mount ID or through a proc/fd/ type symlink. So if you have a path, there are two options: - find out the mount ID belonging to that path and go to /mountfs/$mntid/ - open the path with fd = open(path, O_PATH) and the go to /proc/self/fdmount/$fd/ Currently the only way to find the mount id from a path is by parsing /proc/self/fdinfo/$fd. It is trivial, however, to extend statx(2) to return it directly from a path. Also the mount notification queue that David implemented contains the mount ID of the changed mount. > Don't get me wrong, neither the proc nor the fsinfo implementations > deal with the notification storms that cause much of the problem we > see now. > > IMHO that's a separate and very difficult problem in itself that > can't even be considered until getting the information efficiently > is resolved. This mount notification storm issue got me thinking. If I understand correctly, systemd wants mount notifications so that it can do the desktop pop-up thing. Is that correct? But that doesn't apply to automounts at all. A new mount performed by automount is uninteresting to to desktops, since it's triggered by crossing the automount point (i.e. a normal path lookup), not an external event like inserting a usb stick, etc... Am I missing something? Maybe the solution is to just allow filtering out such notifications at the source, so automount triggers don't generate events for systemd. Thanks, Miklos