Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp332343pxa; Wed, 12 Aug 2020 03:15:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz95JRlGqHOYal/K5NEOO2YBHlockb9LdhXejilZH8qjg2KxwhK+73509lschqpMXqKOyYW X-Received: by 2002:a17:906:eb90:: with SMTP id mh16mr29530571ejb.10.1597227330476; Wed, 12 Aug 2020 03:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597227330; cv=none; d=google.com; s=arc-20160816; b=gJ9NRS/A8qRAxutQoHylWgJ/PbDSKp82rVw1IlDE7pMJvKGr8oAAAHBheSVdN1vDsl Ei3S28CY0JrgNEeU4KDzv3ir7Hnf0a9d56O3TBdjcbWyrkOeg8V2thaEuN7Upp89AkIo WCflsgLW5qtdhigWn8FweDO+L5W/kQJ2/TXygkVkQzOf0DLr0YTlFCaPn87pKzeDwsGD kkIuJOqJrEYH6Hqx7k/8/R9TLqWvDLD4XyaZyvOlsf3+RXyyBS8TBuD+9aWi9IWsp26V RUSLE8NHEIfR/TnpGir7Pd+HKZ6q9NiaI9XfmYzIp92v6dhX5MHcbW+D9mrYDX1/vm9W l+Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=xlMaPj1QKypnrQ0JYf3BSvOZztYvxS9nKRk9zqeHA7Y=; b=EW1cuj3kGtyClHKPZc8ONf77FTsOvoFNdoBzjud1ntFVZUEoO9JJB2is+HJgUH02cB DDmo2NSsvMuvvgc7nyrHFt0whF3ovoMRdaD6B94jTIo/hkMNC3r0Z3UvODoOiH1hNjvx tpjXJUm5BCc0/SxuRq365D0UAVSPScFi1paF3FS4MccE0aL6w/U/erNut6h7HsUcjs+N vv/oZ2NBBkuaFfARUM2eHhHXjUpcEi/YEaQoMFq8kU5TChLzfx3kbJKW8QwOyPQMH2H6 2faNxTarGtluVypNy9mV+/0k0nslKZktbxquW9zrwgp6p6EZHd8bcZVQd9kTluwVIMq4 IJlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Isi6oYcu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id jo2si842066ejb.633.2020.08.12.03.15.07; Wed, 12 Aug 2020 03:15:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Isi6oYcu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727843AbgHLKOW (ORCPT + 99 others); Wed, 12 Aug 2020 06:14:22 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:52664 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727112AbgHLKOV (ORCPT ); Wed, 12 Aug 2020 06:14:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597227260; 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=xlMaPj1QKypnrQ0JYf3BSvOZztYvxS9nKRk9zqeHA7Y=; b=Isi6oYcuaQL/N5QcBPC06FeukL+0Z42GTgP/TBPHqA3thEmAptzRQn4XOwuyRX7mXH4eyo ehyjI5ECuIBCj6SvgDZomHldUAJFyhivKGdPGoVGJDBgrg5mgWmb4/KCrOTfwaidESwh09 mbGMPqyhlQFJcSurNHcIOKiOG+HzUlo= 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-50-nnbUiC46N7C0aUmdRLKZbg-1; Wed, 12 Aug 2020 06:14:16 -0400 X-MC-Unique: nnbUiC46N7C0aUmdRLKZbg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 580991DE0; Wed, 12 Aug 2020 10:14:14 +0000 (UTC) Received: from ws.net.home (unknown [10.40.193.69]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B7C6B60C84; Wed, 12 Aug 2020 10:14:08 +0000 (UTC) Date: Wed, 12 Aug 2020 12:14:05 +0200 From: Karel Zak To: Linus Torvalds Cc: Miklos Szeredi , linux-fsdevel , David Howells , Al Viro , Jeff Layton , Miklos Szeredi , Nicolas Dichtel , Christian Brauner , Lennart Poettering , Linux API , Ian Kent , LSM , Linux Kernel Mailing List Subject: Re: file metadata via fs API (was: [GIT PULL] Filesystem Information) Message-ID: <20200812101405.brquf7xxt2q22dd3@ws.net.home> References: <1842689.1596468469@warthog.procyon.org.uk> <1845353.1596469795@warthog.procyon.org.uk> <20200811135419.GA1263716@miu.piliscsaba.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 11, 2020 at 08:20:24AM -0700, Linus Torvalds wrote: > IOW, if you do something more along the lines of > > fd = open(""foo/bar", O_PATH); > metadatafd = openat(fd, "metadataname", O_ALT); > > it might be workable. I have thought we want to replace mountinfo to reduce overhead. If I understand your idea than we will need openat()+read()+close() for each attribute? Sounds like a pretty expensive interface. The question is also how consistent results you get if you will read information about the same mountpoint by multiple openat()+read()+close() calls. For example, by fsinfo(FSINFO_ATTR_MOUNT_TOPOLOGY) you get all mountpoint propagation setting and relations by one syscall, with your idea you will read parent, slave and flags by multiple read() and without any lock. Sounds like you can get a mess if someone moves or reconfigure the mountpoint or so. openat(O_ALT) seems elegant at first glance, but it will be necessary to provide a richer (complex) answers by read() to reduce overhead and to make it more consistent for userspace. It would be also nice to avoid some strings formatting and separators like we use in the current mountinfo. I can imagine multiple values separated by binary header (like we already have for watch_notification, inotify, etc): fd = openat(fd, "mountinfo", O_ALT); sz = read(fd, buf, BUFSZ); p = buf; while (sz) { struct alt_metadata *alt = (struct alt_metadata *) p; char *varname = alt->name; char *data = alt->data; int len = alt->len; sz -= len; p += len; } Karel -- Karel Zak http://karelzak.blogspot.com