Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp201875ybb; Tue, 7 Apr 2020 20:39:28 -0700 (PDT) X-Google-Smtp-Source: APiQypKGwuuRR1wqiZRHQkLaKvhjaL1ChUdWrJtWuTSG7YodZMrtAjo95/gojUpgbz88PJc+FV9J X-Received: by 2002:a05:6808:43:: with SMTP id v3mr1039094oic.59.1586317167910; Tue, 07 Apr 2020 20:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586317167; cv=none; d=google.com; s=arc-20160816; b=rK0F1LMGufgy8pa5wf4b2nYHqLTo/rUoH4/ZZQYFn4NEOKEvf2i4fgvKcdOxSHDql4 dAItcF8O1+WSgt/Y4X7a0zfPTVxgUsrYE0+VnWMcG/Q8bgxe4JHuamqFi4ywuLTWcx1p Nc+jKtk0LfIXOEOZjOL62PARAE1SBH3Q+6cHOeMP5QHKt82f66poxBp16VqFKvk6QfFV FVofA+DqmfAF+XVKM9stkOIg33JIutPfQwCKaxMwd+JoxcgSMeXhp3sv1i1eWd3SlqjS 2hQ+UPQtuiT4nhqNEfx6pa4q1tbbMF/GM4UeUH9snQbLuevKIxjSXRtIVY94tlWkuZKW ojUw== 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=NJf9EXNj3y/TKHffW9ag62Sko1WtINX0aC0YEmTe104=; b=Sz5wlV8EoPZhMnb201FmEn9uhwjUkFjvRwgdV7prD1ucxGa/G7HKg02iEiSlBVGmuu xp1DYx31kd/or1eMA7ILUJcOJdIiY77GYyH9MA+394LBsBOZfj8VJ5RaFCVC7+PwzEQK L/jWCkaNDVS1eAup/fYaHojeyYWF9Fpm/CbCBHc58WUEag6DvbZ0m48TVyAvaEg2zQlY CxqWWqfhjtrqaCN6HbX9IZWjpezBraTnp5r5axzAmnEL5pT5pNRDMWI+7E9lWlZ0v/Ey 9lp/cho4CNFt9v1AH4pZb/cJ/t8beghyuAfDGrEEWxWk+eEz9i4bEixdi2i3XA9ipO8B nNTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=S5OUs8S2; 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 c31si1874479otb.281.2020.04.07.20.39.02; Tue, 07 Apr 2020 20:39:27 -0700 (PDT) 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=@linux-foundation.org header.s=google header.b=S5OUs8S2; 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 S1726521AbgDHDgu (ORCPT + 99 others); Tue, 7 Apr 2020 23:36:50 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:38382 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726464AbgDHDgu (ORCPT ); Tue, 7 Apr 2020 23:36:50 -0400 Received: by mail-lf1-f66.google.com with SMTP id l11so4029051lfc.5 for ; Tue, 07 Apr 2020 20:36:47 -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=NJf9EXNj3y/TKHffW9ag62Sko1WtINX0aC0YEmTe104=; b=S5OUs8S2WPRcFflOiuuZsTxZ8A1VyAyMWTd+UIkBzHeqvN6tEv6DNT/Bpoq4rp7OB+ ggO9z6fRYGobw4WBVT1GwWBGUhc1933I2vOXImxppct2Mq6upT6lf6wE5i9FG0JmTvnn rr5kl3i0aGePIwNow27mp+LGMU0yoljl7cDiI= 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=NJf9EXNj3y/TKHffW9ag62Sko1WtINX0aC0YEmTe104=; b=GiFwmWifOcGuXgTeRkuGoVm4XN8rCoi+KAepZ1qSAM4OB/1nkaaslQx0rx+En+UjUp wGuRyfti0ZGLkJUoUnEqBvmdinJwXPUR8WhEJJEY+wXlNILGugAz9lcO4koF8tpMUR3n PF7l2r7w1o647UMonEEh/cP7v+qSlJFM5wM78SqS3Q+2pYNP5KhlBXwajQI0Rl2vgEJ2 DVwsF1v4BJAm2m5ub9Px85rNoaGEYqUHTpJ69MfbytFp83bSutQFEtQukxR5sZj3JM2M kgeUbg46DwXE5Rv3q8JmkJC9LZec03ptyjuov2aX3IDohGROoXYrrgbrTkszZ58/nQpd 8PPg== X-Gm-Message-State: AGi0Pua8Vb2/bKo8cyOPFMfRWajRmgoBLfuNIXDoNNAy+jjn+Apd2aBe IEugykwLYMEGzRa+GBfPHdTFlN+yPwE= X-Received: by 2002:ac2:46f9:: with SMTP id q25mr3262941lfo.149.1586317005770; Tue, 07 Apr 2020 20:36:45 -0700 (PDT) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com. [209.85.167.50]) by smtp.gmail.com with ESMTPSA id s10sm12978056ljp.87.2020.04.07.20.36.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Apr 2020 20:36:44 -0700 (PDT) Received: by mail-lf1-f50.google.com with SMTP id z23so4017378lfh.8 for ; Tue, 07 Apr 2020 20:36:44 -0700 (PDT) X-Received: by 2002:ac2:4466:: with SMTP id y6mr3241858lfl.125.1586317003620; Tue, 07 Apr 2020 20:36:43 -0700 (PDT) MIME-Version: 1.0 References: <36e45eae8ad78f7b8889d9d03b8846e78d735d28.camel@themaw.net> <27994c53034c8f769ea063a54169317c3ee62c04.camel@themaw.net> <20200403111144.GB34663@gardel-login> <20200403151223.GB34800@gardel-login> <20200403203024.GB27105@fieldses.org> <20200406091701.q7ctdek2grzryiu3@ws.net.home> <20200406184812.GA37843@gardel-login> In-Reply-To: <20200406184812.GA37843@gardel-login> From: Linus Torvalds Date: Tue, 7 Apr 2020 20:36:27 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Upcoming: Notifications, FS notifications and fsinfo() To: Lennart Poettering Cc: Karel Zak , "J. Bruce Fields" , Miklos Szeredi , Ian Kent , David Howells , Christian Brauner , Al Viro , dray@redhat.com, Miklos Szeredi , Steven Whitehouse , Jeff Layton , andres@anarazel.de, keyrings@vger.kernel.org, linux-fsdevel , Linux Kernel Mailing List , Aleksa Sarai 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 Mon, Apr 6, 2020 at 11:48 AM Lennart Poettering wrote: > > On Mo, 06.04.20 09:34, Linus Torvalds (torvalds@linux-foundation.org) wrote: > > > On Mon, Apr 6, 2020 at 2:17 AM Karel Zak wrote: > > > > > > On Fri, Apr 03, 2020 at 04:30:24PM -0400, J. Bruce Fields wrote: > > > > > > > > nfs-utils/support/misc/mountpoint.c:check_is_mountpoint() stats the file > > > > and ".." and returns true if they have different st_dev or the same > > > > st_ino. Comparing mount ids sounds better. > > > > > > BTW, this traditional st_dev+st_ino way is not reliable for bind mounts. > > > For mountpoint(1) we search the directory in /proc/self/mountinfo. > > > > These days you should probably use openat2() with RESOLVE_NO_XDEV. > > Note that opening a file is relatively "heavy" i.e. typically triggers > autofs and stuff, and results in security checks (which can fail and > such, and show up in audit). For the use that Bruce outlined, openat2() with RESOLVE_NO_XDEV is absolutely the right thing. He already did the stat() of the file (and ".."), RESOLVE_NO_XDEV is only an improvement. It's also a lot better than trying to parse mountinfo. Now, I don't disagree that a statx() flag to also indicate "that's a top-level mount" might be a good idea, and may be the right answer for other cases. I'm just saying that considering what Bruce does now, RESOLVE_NO_XDEV sounds like the nobrainer approach, and needs no new support outside of what we already had for other reasons. (And O_PATH _may_ or may not be part of what you want to do, it's an independent separate issue, but automount behavior wrt a O_PATH lookup is somewhat unclear - see Al's other emails on that subject) Linus