Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp112137lqb; Thu, 23 May 2024 12:18:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJQ7RVTnnyjdItEcrfRbCvil/rDOsXPt7TXsoRLf3oz2SFbjYABRU2VMPPVwFVZqzkbVcscjNoZYYMFDTri/R31WZ/HLUf2eYXw56Cwg== X-Google-Smtp-Source: AGHT+IEv110w6rO10lACfY9le4gTNHC1d9XPTxCRSEyK+KXcm2iQtkYOcePT2q+u2UmelTlgZyWu X-Received: by 2002:a25:cecf:0:b0:df4:df91:aba0 with SMTP id 3f1490d57ef6-df77215ebf9mr176704276.5.1716491898311; Thu, 23 May 2024 12:18:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716491898; cv=pass; d=google.com; s=arc-20160816; b=DWmJRS1r+kRHabhu9aAa9OJmH59UFY4xBsIERdM4qt1q0nBSKWHvxnhxql1l7VkyEM aMFzZwAADTSSzNDLwx38kzv9NE08gKxLZ7vAWUE/VgTTn+BquvIvWovAZApeZHjKgIyO XPlTC5dGaKxWM6fKcQiYABm8B9FTI1NHMGmM2z+gQVTzyZfM3rlKgg/f1UJ8QixvIC+e VPfuZ5YVtDt9ozImoSZs2+HZ+AdRCSEjf1fN76Ptn1G90TS8SUJciFeKv1uqnlqBAmk3 Jmc3NBiR1cbcilhOVfOysoh/66gfE6LoDLEF1qWjdclEl/eIkKK50m32mLpWE0hhNk1k 9yLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uNGUNQ9KsgsDZadcwyQlZ1D5JgSmqisnB6q4PPRM+co=; fh=Q/BMPakJqQMlaTBW4u84NfLRSzOmrJU68paawoWz1cU=; b=DGZHzePFTK811jK36a3qiY7bRHHWys/ezwxBFKG0jazkisIMc0wdZBDDNcKLybKvty ixfQ5v0bF/dwFSdsTmtAxnawKoAE3XWER4HSN0nSCjJzGEyHVajJyDRVB/2KOXOu0WJX cKFfyYOd27D31mrtsmCRvCwvbP+OpucfqiNYCFBAh8mtAEnCzTThQNZyX3v64JP0uE5k 0XvzYgKhPVkudEjgkJi/ZjBraDCDVlDG33/XWrnBmrUnIEkNK2RDeQrSQlQEpm6YukwX APx7dtpW4mLovYvsi9LJYVOWugZAu2LyKVDJgM6juv2B7zzQTsst8S4w6eD/qwxuyXT6 8dYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cyphar.com header.s=MBO0001 header.b=kTSDAl7v; arc=pass (i=1 spf=pass spfdomain=cyphar.com dkim=pass dkdomain=cyphar.com dmarc=pass fromdomain=cyphar.com); spf=pass (google.com: domain of linux-kernel+bounces-187921-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187921-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cyphar.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ab947fe5d7si16892826d6.433.2024.05.23.12.18.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 12:18:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187921-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@cyphar.com header.s=MBO0001 header.b=kTSDAl7v; arc=pass (i=1 spf=pass spfdomain=cyphar.com dkim=pass dkdomain=cyphar.com dmarc=pass fromdomain=cyphar.com); spf=pass (google.com: domain of linux-kernel+bounces-187921-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187921-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cyphar.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9B99E1C22D9A for ; Thu, 23 May 2024 19:18:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F02883CAE; Thu, 23 May 2024 19:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cyphar.com header.i=@cyphar.com header.b="kTSDAl7v" Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7101FEC7; Thu, 23 May 2024 19:17:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716491828; cv=none; b=ZzSZ2l34AMS8PXDupLgBGvSv0AqCOYh1hiL3q8AT4YTxNpSuGclpGXoqI2rNmhi/Q3C8P4y6mNWxaMESMp8qq8wVpXvy780Eo+0EqN+FpFbc4JA6KcM1IkQBSvZLkBe+5iqiaXomjTjOZdRQ5fxSaHtIi4At7lG5NySGnsuEDkU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716491828; c=relaxed/simple; bh=uNGUNQ9KsgsDZadcwyQlZ1D5JgSmqisnB6q4PPRM+co=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=otfuWsHBO2xls9Bzi+BZm98p5o363imXQjA6vfjW8NGKjYZMOPLuCNoyrdtECIbCmMbW9qtwMS2UyMNPV9qXdY0raBh+iEOSeQP81IlY8uyBRkZSOu2QZmwJzn5HMqvkZHCBwxu0BpaMTG2Lcs5CYDhxRm34lvZ2d5gsHLjr8Og= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cyphar.com; spf=pass smtp.mailfrom=cyphar.com; dkim=pass (2048-bit key) header.d=cyphar.com header.i=@cyphar.com header.b=kTSDAl7v; arc=none smtp.client-ip=80.241.56.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cyphar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cyphar.com Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4VldG44NCDz9sqJ; Thu, 23 May 2024 21:17:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cyphar.com; s=MBO0001; t=1716491820; 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=uNGUNQ9KsgsDZadcwyQlZ1D5JgSmqisnB6q4PPRM+co=; b=kTSDAl7vHeF57kcnonDRQSc3BeqErTPPT6cDqYrdAkfygq+3nVu7aBINjkNaa6sA92i71Q bCJwynKZkXM07tVt6/NJeu3c5YaWiiEOb8/rWep3kIN4bTHmL8ZuqVZcEN+8g3huITrzF1 XfDWYqnQxLaBTsgJory/gvVRMTuGZvJ99V5UVp+nsFM7xLeyRTsV6lVIqC6vsFRPCgfA0k Xtn2AK87xA/mSlJPglyPUOdXuxGbEMDNZK1DNL/vyCC985nIbT1F7bqnCGp+regWjB2oLn oa0Z7IbTCoABUna5UUEvLCQ4/95+rwrWVAcwCNbKp/K8YW9v6h5ZrYw1qPW88g== Date: Thu, 23 May 2024 13:16:53 -0600 From: Aleksa Sarai To: Amir Goldstein Cc: Jeff Layton , Christian Brauner , Alexander Viro , Jan Kara , Chuck Lever , Alexander Aring , linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC] fhandle: expose u64 mount id to name_to_handle_at(2) Message-ID: <20240523.173855-tight.bourbon.gnarly.guest-p8Vv3g4JQ9A9@cyphar.com> References: <20240520-exportfs-u64-mount-id-v1-1-f55fd9215b8e@cyphar.com> <20240521-verplanen-fahrschein-392a610d9a0b@brauner> <20240521-patentfrei-weswegen-0395678c9f9a@brauner> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="koyebb3xfqadvath" Content-Disposition: inline In-Reply-To: --koyebb3xfqadvath Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2024-05-21, Amir Goldstein wrote: > On Tue, May 21, 2024 at 5:27=E2=80=AFPM Jeff Layton = wrote: > > > > On Tue, 2024-05-21 at 16:11 +0200, Christian Brauner wrote: > > > On Tue, May 21, 2024 at 03:46:06PM +0200, Christian Brauner wrote: > > > > On Mon, May 20, 2024 at 05:35:49PM -0400, Aleksa Sarai wrote: > > > > > Now that we have stabilised the unique 64-bit mount ID interface = in > > > > > statx, we can now provide a race-free way for name_to_handle_at(2= ) to > > > > > provide a file handle and corresponding mount without needing to = worry > > > > > about racing with /proc/mountinfo parsing. > > > > > > > > > > As with AT_HANDLE_FID, AT_HANDLE_UNIQUE_MNT_ID reuses a statx AT_= * bit > > > > > that doesn't make sense for name_to_handle_at(2). > > > > > > > > > > Signed-off-by: Aleksa Sarai > > > > > --- > > > > > > > > So I think overall this is probably fine (famous last words). If it= 's > > > > just about being able to retrieve the new mount id without having to > > > > take the hit of another statx system call it's indeed a bit much to > > > > add a revised system call for this. Althoug I did say earlier that I > > > > wouldn't rule that out. > > > > > > > > But if we'd that then it'll be a long discussion on the form of the= new > > > > system call and the information it exposes. > > > > > > > > For example, I lack the grey hair needed to understand why > > > > name_to_handle_at() returns a mount id at all. The pitch in commit > > > > 990d6c2d7aee ("vfs: Add name to file handle conversion support") is= that > > > > the (old) mount id can be used to "lookup file system specific > > > > information [...] in /proc//mountinfo". > > > > > > > > Granted, that's doable but it'll mean a lot of careful checking to = avoid > > > > races for mount id recycling because they're not even allocated > > > > cyclically. With lots of containers it becomes even more of an issu= e. So > > > > it's doubtful whether exposing the mount id through name_to_handle_= at() > > > > would be something that we'd still do. > > > > > > > > So really, if this is just about a use-case where you want to spare= the > > > > additional system call for statx() and you need the mnt_id then > > > > overloading is probably ok. > > > > > > > > But it remains an unpleasant thing to look at. > > > > > > And I'd like an ok from Jeff and Amir if we're going to try this. :) > > > > I don't have strong feelings about it other than "it looks sort of > > ugly", so I'm OK with doing this. > > > > I suspect we will eventually need name_to_handle_at2, or something > > similar, as it seems like we're starting to grow some new use-cases for > > filehandles, and hitting the limits of the old syscall. I don't have a > > good feel for what that should look like though, so I'm happy to put > > that off for a while. >=20 > I'm ok with it, but we cannot possibly allow it without any bikeshedding.= =2E. >=20 > Please call it AT_HANDLE_MNT_ID_UNIQUE to align with > STATX_MNT_ID_UNIQUE >=20 > and as I wrote, I do not like overloading the AT_*_SYNC flags > and as there is no other obvious candidate to overload, so > I think that it is best to at least declare in a comment that >=20 > /* 0x00ff flags are reserved for per-syscall flags */ >=20 > and use one of those bits for AT_HANDLE_MNT_ID_UNIQUE. I can switch the flag to use 0x80, but given there are already exceptions to that rule, it seems unlikely that this is going to be a strong guarantee going forward. I will add a comment though. Note that this will mean that we are planning to only have 15 remaining generic AT_* flags. > It does not matter whether we decide to unify the AT_ flags > namespace with RENAME_ flags namespace or not. >=20 > The fact that there is a syscall named renameat2() with a flags > argument, means that someone is bound to pass in an AT_ flags > in this syscall sooner or later, so the least we can do is try to > delay the day that this will not result in EINVAL. While there is a risk this could happen, in theory a user could also incorrectly pass AT_* to open(). While ergonomics is important, I think that most users generally read the docs when figuring out how to use flags for syscalls (mainly because we don't have a unified flag namespace for all syscalls) so I don't think this is a huge problem. (But I'm sure I was part of making this problem worse with RESOLVE_* flags.) > Thanks, > Amir. >=20 > P.S.: As I mentioned to Jeff in LSFMM, I have a patch in my tree > to add AT_HANDLE_CONNECTABLE which I have not yet > decided if it is upstream worthy. --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --koyebb3xfqadvath Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQS2TklVsp+j1GPyqQYol/rSt+lEbwUCZk+WJQAKCRAol/rSt+lE by4TAQCQNUX2D7HCh+NV0JF21tYfwHBNUcQ/1BWdJAddqW2nqgD9Hwc/zOJ0PXj2 huGbDPFBr/cHKpn0xPi/6A7iy0pjuAU= =2vgL -----END PGP SIGNATURE----- --koyebb3xfqadvath--