From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C35F9C433E1 for ; Tue, 11 Aug 2020 15:20:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A7452078E for ; Tue, 11 Aug 2020 15:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597159248; bh=ebxY0fLYyFD3bCoJFQxYp3Sulg3by0GmfajwxeS0Trs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=eSfvookp/SIRRiXPWYg1mR/9c4n4JnOaUkBqsbV+D2tTj+YDAgoR0nh1ZgI9lZMcZ y0axYK+8FNvyUcjln4LrzWzf62pWQZsU6VuiOf10ffwS5NVnFY0Oi1RCn92Gx92qpl ChynORKa6U0Psk76ydOz1qu1/g3h5g00dfmtogEY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728860AbgHKPUq (ORCPT ); Tue, 11 Aug 2020 11:20:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728833AbgHKPUq (ORCPT ); Tue, 11 Aug 2020 11:20:46 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B768C061788 for ; Tue, 11 Aug 2020 08:20:45 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id v15so6857633lfg.6 for ; Tue, 11 Aug 2020 08:20:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bx6crtxCZeThOx4D4bD3ehsUEC/VPmmXSGnr3LbBSBM=; b=fuVOZ6VXbzk9u1owlS5IWY/26dqpjDl8Zn92+ZwUfu1Iht5ylUjVdvAnr4KRzCh7VV 901ieKbmeI/uj2OiDMkFTEr6IDlawY4EVR5ym128Z6kvWcI5hAIhMBgVCcgpeT57dS6W FJmGAlO9FQumMVHcvcBKzUuxybYBj4tt5eXdQ= 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=bx6crtxCZeThOx4D4bD3ehsUEC/VPmmXSGnr3LbBSBM=; b=KjKIMnC59U36SolUEev/ZV1tOvwYGZO/Q80VEFQs078aYetMswtC0mVYJOl2QznLWi kWj9b0W+M6ocQQ7jozBgEaJCtI86QxuaF+QuZoJmc8ACygdjhr5lGa3Y16iBJUtxxuX/ /HyvqGh2IhDbdpMC0wU2Kph+V3UfHLBqbzAHMGJ5CkBdd6laLcQuXm/qn+o3LeG2WN8K ppL6HHVw6TcntjA8sGFwDGvi3XTrDiSzykENHFa76QeAJWAaXY2wXEhM/y4nnwQ62nSr opQfQ9/O0UE49A0KwXvpGZtxfTs29ZEWKIAAif0CdZjfe1+tvsLPB9c25lxRm68ainL8 a0bw== X-Gm-Message-State: AOAM531SEkcFVpAYywHN35YhBx2YoKMO7UAroYgVTCvvNMWUdyC5lyDY AvEAyUnb42gZBLDdQtlPba7zZZjqfVM= X-Google-Smtp-Source: ABdhPJzhI9OezhOkaNuIJVGmFz9wnJb/yVc3QRfuPprJGkAZrQrCvVIPm2YgZQzqDag/mMbK2l+Dow== X-Received: by 2002:a19:8095:: with SMTP id b143mr3470220lfd.175.1597159242549; Tue, 11 Aug 2020 08:20:42 -0700 (PDT) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id x13sm11719199lfr.95.2020.08.11.08.20.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Aug 2020 08:20:41 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id h19so13935077ljg.13 for ; Tue, 11 Aug 2020 08:20:40 -0700 (PDT) X-Received: by 2002:a2e:545:: with SMTP id 66mr3363842ljf.285.1597159240486; Tue, 11 Aug 2020 08:20:40 -0700 (PDT) MIME-Version: 1.0 References: <1842689.1596468469@warthog.procyon.org.uk> <1845353.1596469795@warthog.procyon.org.uk> <20200811135419.GA1263716@miu.piliscsaba.redhat.com> In-Reply-To: <20200811135419.GA1263716@miu.piliscsaba.redhat.com> From: Linus Torvalds Date: Tue, 11 Aug 2020 08:20:24 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: file metadata via fs API (was: [GIT PULL] Filesystem Information) To: Miklos Szeredi Cc: linux-fsdevel , David Howells , Al Viro , Karel Zak , Jeff Layton , Miklos Szeredi , Nicolas Dichtel , Christian Brauner , Lennart Poettering , Linux API , Ian Kent , LSM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org [ I missed the beginning of this discussion, so maybe this was already suggested ] On Tue, Aug 11, 2020 at 6:54 AM Miklos Szeredi wrote: > > > > > E.g. > > openat(AT_FDCWD, "foo/bar//mnt/info", O_RDONLY | O_ALT); > > Proof of concept patch and test program below. I don't think this works for the reasons Al says, but a slight modification might. 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. So you couldn't do it with _one_ pathname, because that is always fundamentally going to hit pathname lookup rules. But if you start a new path lookup with new rules, that's fine. This is what I think xattrs should always have done, because they are broken garbage. In fact, if we do it right, I think we could have "getxattr()" be 100% equivalent to (modulo all the error handling that this doesn't do, of course): ssize_t getxattr(const char *path, const char *name, void *value, size_t size) { int fd, attrfd; fd = open(path, O_PATH); attrfd = openat(fd, name, O_ALT); close(fd); read(attrfd, value, size); close(attrfd); } and you'd still use getxattr() and friends as a shorthand (and for POSIX compatibility), but internally in the kernel we'd have a interface around that "xattrs are just file handles" model. Linus