Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp509995pxa; Tue, 11 Aug 2020 08:21:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyymUUg49nqosWn/EIcwx58np7hOmUy943F1Tp6bRFHrhosGBQovzpapJJCicdv+V907U0K X-Received: by 2002:a17:907:385:: with SMTP id ss5mr25982469ejb.496.1597159298774; Tue, 11 Aug 2020 08:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597159298; cv=none; d=google.com; s=arc-20160816; b=CupQISLg+rbT+nq2a8W7e38VbI3msZSRIGnfExfMZ6h4o0wb7zs0BpD/YJ3qGaa6ea 6nksg5RkU0DNXdrd8T5QxLrJ0ZJCjofDBweg1yyQd+vGezXIWwQb718F1RxHtyXB8uhy A95Y2aKlEialJYF67LaIIJrRb4L1yIyJ3F5nqIVa19+ehPS04BQoGZ97g7VLGdzjAnS4 5uFsdQkOsECKXCWysgLTFRrM4qJiwIN7D09tms14ia8D8cvhFwR2bNWDaENSESUQNbKO 8EPnGGDljDJILVJUa1Irw2gQ04Uknf96po4s3EQxWrUs+oGGyKvk8oyzahl5F+ib44DL woQA== 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=bx6crtxCZeThOx4D4bD3ehsUEC/VPmmXSGnr3LbBSBM=; b=TFU7l7dmmlmuYbsBFk9OZeT8hjLADFjv/LBdLfDKuasmj+sD0x8G+/jBGP7a5e4msS 1/UBBjrhVNRVQngtQRGeKkxa+9w58lKy+CFye77sVs46nnLhKn+Xo2NGHhV7eVSeF9Ty KRp1L7NgxkMMaKUwnvdWTw97jLRz9v3aXJGrS8HV8QkQDO3m5EARsCWjkT12fFkCf6Nv W/IAkNtZQ0iEgx3q2/ccgd7/lelO520XLFj2yJpxieSTakG6UIl8YytwjxQ3z1mfOsRU QHY3eNOOlbYscnWcYwfA9QAejBcL09q1qN34/IyQWKmyGoah8K03q/7mJp6ZNT2hDpz0 Tm9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=fuVOZ6VX; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m24si12684107edr.211.2020.08.11.08.21.15; Tue, 11 Aug 2020 08:21:38 -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=@linux-foundation.org header.s=google header.b=fuVOZ6VX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728859AbgHKPUq (ORCPT + 99 others); Tue, 11 Aug 2020 11:20:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728783AbgHKPUp (ORCPT ); Tue, 11 Aug 2020 11:20:45 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EF69C06174A for ; Tue, 11 Aug 2020 08:20:44 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id v12so13938797ljc.10 for ; Tue, 11 Aug 2020 08:20:44 -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=EwI7rx4DXxlJYquGqYrh0JJborW32diDisnKGIeYawe9owFW/TD11QlEztVvPyj49o B9t3aM5CUdPPzanXxENMPFyFBOUGJ88dFSJ/E7DmZZnttg4BtYFlVPFRvtIiSWGy/DIh pWEqy+F85qBkxeXT+jf2gV0fLC3A1S7AqsecqAshvv3hgVBUV61VzkJIbowVUa4JW7ig ST8XGu4i1rWvKMOyw8dgkPI9G5GzPbAcECiUkdTimcjwetNX95zGyeOlOteNO+0no4Ox wncyKXi6sc1Bs3A2C59lWFWq4TNrLIYJO+718ifLQgEhl5Hvhk5AzGqZa2aaVzDvyiN6 0lDw== X-Gm-Message-State: AOAM530yoXC1gi8vlaZVF2gr9Let5/ag9o2waDEE516i3RueqWaSVz9s u11cdlq+Cq+Qfvh7XciSwB5SPNS9V/M= X-Received: by 2002:a05:651c:23a:: with SMTP id z26mr3142838ljn.257.1597159242327; Tue, 11 Aug 2020 08:20:42 -0700 (PDT) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com. [209.85.208.171]) by smtp.gmail.com with ESMTPSA id g6sm11752403lfr.51.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-f171.google.com with SMTP id z14so13989006ljm.1 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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