Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3206288ybf; Tue, 3 Mar 2020 01:27:05 -0800 (PST) X-Google-Smtp-Source: ADFU+vtaY3zXqltcIeoHSBvSY4yYvHzDYK1RX9e8z8JErs1j//xHvUfon+bTGjx39zznUNBVNlHS X-Received: by 2002:a9d:6544:: with SMTP id q4mr2520618otl.269.1583227625072; Tue, 03 Mar 2020 01:27:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583227625; cv=none; d=google.com; s=arc-20160816; b=iz95783XKkz3ANxOJ94qjcfh6aoFoZaDdc0dL5hzcyWxKMW5TlwIfyr9LEMINJ7+nw EF67nqU3aT+9wTEiL2M2nAe5pJuGtiBvptFyq8OERR6kDIgdqpODZDUf094+4zleGIJJ TyGpPodi2+ehBv4DROX5wdH46xLu5iKUT618siWNSfSiQ2eCJXKGRSDI2/Bo9qYkydwi wAxeOwmokPlk9aKmQjOwMmU50Uh6Prx7g16Xjg13OqvnzF+g+y9/KLNaC4pR1mMSka+E AwZkhXJLJSbMCvxKf0OCouWUO/dMF3ylQSNU1Jovq56knqf4nB2WEfWTKyCvnRzeseAP 5cJg== 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=Q9Z8EsyPHV9U0NaiC6B9M0rvBM6gtbnKLyzu2j7BTPk=; b=YKC7zSEClrdHWUlAc6aDFfmmdQtj84q9eaLQr8bjt43jAyPD+0zyEJNS2USV5Z+kb3 ke55XUow/uTPG+59mW7eQ3saarec4MzCIVjm+bst1jFkI1Q3rkXLpb3WThL29TBxbhtV VQnx5WbKfL44xipQmiCEYs0CXYz3i2QWRxfQUfSOhtOlIpwg4iRMx70kO/og1Roz/NzO ytKBCCVrnvQk+PEledD/BMKvtreL5vGJHrh/CV0az4xoHFwpXd1XUeRschXvboApKGAm havkcy3muXth0F0P+yis1suc2PV4qq67JRldM6CtOE4xduQzxZsJ6U2e9MekOvWO8t7f HiMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=jTYYh8x3; 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 v22si4878816otq.109.2020.03.03.01.26.52; Tue, 03 Mar 2020 01:27:05 -0800 (PST) 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=jTYYh8x3; 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 S1728041AbgCCJ0d (ORCPT + 99 others); Tue, 3 Mar 2020 04:26:33 -0500 Received: from mail-il1-f193.google.com ([209.85.166.193]:37669 "EHLO mail-il1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727357AbgCCJ0d (ORCPT ); Tue, 3 Mar 2020 04:26:33 -0500 Received: by mail-il1-f193.google.com with SMTP id a6so2162377ilc.4 for ; Tue, 03 Mar 2020 01:26:32 -0800 (PST) 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=Q9Z8EsyPHV9U0NaiC6B9M0rvBM6gtbnKLyzu2j7BTPk=; b=jTYYh8x31RkzNU33Z6lQeUgOoxxpnukS+yid4FC8FJzzyyH0SDDGWJ7wmGFqxzt1U3 ifsrEQ7nwWxkNrLVlPAYrCXiE7lSYj+WiO72qZu3u+/Oo03L4Xpoloy0eSa5/wZjMVQH faFgkLebRgrbn85uVDC/g5bh+gX1xho/fGSc0= 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=Q9Z8EsyPHV9U0NaiC6B9M0rvBM6gtbnKLyzu2j7BTPk=; b=rrvV7sv8DSnqbWS6OJhcuaOigYtkteEq0Ck0azDF/dd7j/dsl7xH93Mrt/Kcq6dOZv dZ4WNhV2SYcwFhcT8zsTNeUTDqlD/Gd8iAklFtq++75NwDVTAAGOsptQXgmbtwZm7NN5 WQm+wfWH0fJxo8YnLntsEDOTfkwKBvw01vhbiJfSDJNujyxy3+O8/iDL27MHhrnK63A3 gZaf99Kr3TNND4+h2DKWoQbSoZSnEjgzwO2ahxo2r9+6+D3lW1dTydZigt6oFvqYRixr 15NxWyBjTWFIb2eiItjL1nXYl1k92U2JC5qPfAgydeFSLVO66vk9jZzh1RhCfR2TxdLt TUmA== X-Gm-Message-State: ANhLgQ0J7+UmSWA25Ljg2lZZA3ga2bqthl2+wwtQUGZ+rqjbKqfvMQlw ZidxKWUyJq+TgpQj8wdjJ3fXte8wfQe/th6s9oydKg== X-Received: by 2002:a92:8d41:: with SMTP id s62mr3559102ild.63.1583227592332; Tue, 03 Mar 2020 01:26:32 -0800 (PST) MIME-Version: 1.0 References: <158230810644.2185128.16726948836367716086.stgit@warthog.procyon.org.uk> <1582316494.3376.45.camel@HansenPartnership.com> <1582556135.3384.4.camel@HansenPartnership.com> <1582644535.3361.8.camel@HansenPartnership.com> <20200228155244.k4h4hz3dqhl7q7ks@wittgenstein> <107666.1582907766@warthog.procyon.org.uk> <0403cda7345e34c800eec8e2870a1917a8c07e5c.camel@themaw.net> <1509948.1583226773@warthog.procyon.org.uk> In-Reply-To: <1509948.1583226773@warthog.procyon.org.uk> From: Miklos Szeredi Date: Tue, 3 Mar 2020 10:26:21 +0100 Message-ID: Subject: Re: [PATCH 00/17] VFS: Filesystem information and notifications [ver #17] To: David Howells Cc: Ian Kent , Christian Brauner , James Bottomley , Steven Whitehouse , Miklos Szeredi , viro , Christian Brauner , Jann Horn , "Darrick J. Wong" , Linux API , linux-fsdevel , lkml , Greg Kroah-Hartman 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 Tue, Mar 3, 2020 at 10:13 AM David Howells wrote: > > Miklos Szeredi wrote: > > > I'm doing a patch. Let's see how it fares in the face of all these > > preconceptions. > > Don't forget the efficiency criterion. One reason for going with fsinfo(2) is > that scanning /proc/mounts when there are a lot of mounts in the system is > slow (not to mention the global lock that is held during the read). > > Now, going with sysfs files on top of procfs links might avoid the global > lock, and you can avoid rereading the options string if you export a change > notification, but you're going to end up injecting a whole lot of pathwalk > latency into the system. Completely irrelevant. Cached lookup is so much optimized, that you won't be able to see any of it. No, I don't think this is going to be a performance issue at all, but if anything we could introduce a syscall ssize_t readfile(int dfd, const char *path, char *buf, size_t bufsize, int flags); that is basically the equivalent of open + read + close, or even a vectored variant that reads multiple files. But that's off topic again, since I don't think there's going to be any performance issue even with plain I/O syscalls. > > On top of that, it isn't going to help with the case that I'm working towards > implementing where a container manager can monitor for mounts taking place > inside the container and supervise them. What I'm proposing is that during > the action phase (eg. FSCONFIG_CMD_CREATE), fsconfig() would hand an fd > referring to the context under construction to the manager, which would then > be able to call fsinfo() to query it and fsconfig() to adjust it, reject it or > permit it. Something like: > > fd = receive_context_to_supervise(); > struct fsinfo_params params = { > .flags = FSINFO_FLAGS_QUERY_FSCONTEXT, > .request = FSINFO_ATTR_SB_OPTIONS, > }; > fsinfo(fd, NULL, ¶ms, sizeof(params), buffer, sizeof(buffer)); > supervise_parameters(buffer); > fsconfig(fd, FSCONFIG_SET_FLAG, "hard", NULL, 0); > fsconfig(fd, FSCONFIG_SET_STRING, "vers", "4.2", 0); > fsconfig(fd, FSCONFIG_CMD_SUPERVISE_CREATE, NULL, NULL, 0); > struct fsinfo_params params = { > .flags = FSINFO_FLAGS_QUERY_FSCONTEXT, > .request = FSINFO_ATTR_SB_NOTIFICATIONS, > }; > struct fsinfo_sb_notifications sbnotify; > fsinfo(fd, NULL, ¶ms, sizeof(params), &sbnotify, sizeof(sbnotify)); > watch_super(fd, "", AT_EMPTY_PATH, watch_fd, 0x03); > fsconfig(fd, FSCONFIG_CMD_SUPERVISE_PERMIT, NULL, NULL, 0); > close(fd); > > However, the supervised mount may be happening in a completely different set > of namespaces, in which case the supervisor presumably wouldn't be able to see > the links in procfs and the relevant portions of sysfs. It would be a "jump" link to the otherwise invisible directory. Thanks, Miklos