Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3197465ybf; Tue, 3 Mar 2020 01:14:50 -0800 (PST) X-Google-Smtp-Source: ADFU+vuMiQpjBxHESnEJ/dkF8ivQBHribV86dV9vH4Q421HYsGLLBj4OLBq5sYpOimRLetD8tjnU X-Received: by 2002:a9d:c69:: with SMTP id 96mr2737903otr.129.1583226890649; Tue, 03 Mar 2020 01:14:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583226890; cv=none; d=google.com; s=arc-20160816; b=jgNkbAA9pnybIGX+ShlQQlBHGVt3CWMwwhbyrcdE8ZkczkReK3DOnUspyfRXbXfXvY aUlvvSFlrDudSINA3G5bKh+BwnJ2iFiNpGvzTrCt0jUemDESFcWvc/alpMOwS33Rrgas czA0R7/zToAnupagVsgME9+MXNNppEiKnUXEdA5vXI/fgIvoTU5wZvzmViuRyR254LmP aVtgvnpB3si9Z9YNX4qol7sx67ThBTYUQM2+TX6viS/BmecsMqwuUOTTm0yuB67CT9+S MGab2Ule1F2dxbDg3DbBTw7FK5QiT6ms9mWBs2MaI9qeQpq2UEVvhA4UtanH5LmwGr/l jvhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :dkim-signature; bh=qMP4Yyr6RpOE+LNq0HWY7JfUV3/6ReV0xC+ZidKNJgU=; b=ngDHcios2SBKadoZfb86h3Bzn5ldTF8fu812g57/TkBJMeNnvgr7ssXfIoxjfhVSkL LX6wbaqbrVr1BFH+t8KBVYcJ+LwHkvDMyiEp3EHSUJpWxIuXCljuvaXs5XPT/jxoQz+O 1KICKmBEmZXfHQzaTqZuPiBvxXbdhnpDlOBiINHII3PjpiivozPGltz2X3M2YPj/w+4h +SINBvqY7g0WgFKdlrRh7/ojTflLm86OE2bXgvzZLXkkGnfr8nDLVCHbkgD/RZ9yqv6L RXZ0kLO5nZT0lxFChzIrrP2eEOK6VQTMDbht/W68zXERGRbGZEOySgpKLPcWizxHplox 0KRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="CgZP405/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f187si8381332oia.218.2020.03.03.01.14.29; Tue, 03 Mar 2020 01:14:50 -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=pass header.i=@redhat.com header.s=mimecast20190719 header.b="CgZP405/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727989AbgCCJNF (ORCPT + 99 others); Tue, 3 Mar 2020 04:13:05 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:26589 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725440AbgCCJNE (ORCPT ); Tue, 3 Mar 2020 04:13:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583226783; h=from:from:reply-to:subject:subject: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=qMP4Yyr6RpOE+LNq0HWY7JfUV3/6ReV0xC+ZidKNJgU=; b=CgZP405/WZRTwns8NWSJYEMlJLTgh63riPIRebPrXnArszTGYMYJ8cd9OlgaR1WTYBKVlO Z4qTqp41f/K8iUAoDKkZzWZ6ZFrEKoe2RNtr7JfOgjiUXYZseet1FahgfOc4DEaGiMGjUm 1mzxO8KUAVNh5EFxpf0Cw4bzMLin85U= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-Y08eRkhaPm2zAg6y2Z84lg-1; Tue, 03 Mar 2020 04:12:59 -0500 X-MC-Unique: Y08eRkhaPm2zAg6y2Z84lg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 65E301005F83; Tue, 3 Mar 2020 09:12:57 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-182.rdu2.redhat.com [10.10.120.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6012C91D74; Tue, 3 Mar 2020 09:12:54 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: 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> To: Miklos Szeredi Cc: dhowells@redhat.com, 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 Subject: Re: [PATCH 00/17] VFS: Filesystem information and notifications [ver #17] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1509947.1583226773.1@warthog.procyon.org.uk> Date: Tue, 03 Mar 2020 09:12:53 +0000 Message-ID: <1509948.1583226773@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. David