Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2567860pxj; Mon, 10 May 2021 06:06:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbRkWpfUUOSlCuc2EyClhCnv5zS3hFvajXdu/J/aobcGywnapjj7DlcXak/h+Jvywj4Hyh X-Received: by 2002:a17:907:2050:: with SMTP id pg16mr3492588ejb.255.1620651991124; Mon, 10 May 2021 06:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620651991; cv=none; d=google.com; s=arc-20160816; b=PrRg6IY9CNmSCX/VJCWpOez8Po5lnCBKnj+Mbu04EjtWMR+UexK4t6eD6f+5utIBTa uUxEtKCrUnscANPFBXUL9ymiicZSV7QGENJVyeNWe5J8PbMNiOaFtcCmmm0vAz3xl7hy aOHNlweKcUD/lx+5GmLn7jIh0g/+s2NGaQRmcM/ps+xkgoMDxfqCU9KbNjvh2fgQc58Y xIi2u/fMWFcCt21c3H5BmyUA4FfHjjWDzrwEo2yW21ocz+5rBNE7vcSYJMkBkBZwU6M1 YH8ZtlKiCvqVgtnfcNExL/yhGtMxIB8Fvhom2VH7Bx0YbPhOVPxDjQNZ/UwlknAaHEE1 HCEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=aqGbgVDU3DRzGKZvKis1XBbRMUZVDrJl5uYe0oabxPI=; b=J8Hf/Imq2ENlPdhFIEs0ZklB3lRHsr+vbTO5gq4I+O3UR4ZEJQdVKBZLko12ZpAYQr XSdkSfHt93sBceN0C04FKBgYOOSkXEaCCi8dfqr7L9uwVvT0eYZdkDqJJT5AJBjC8RBM vIxB2PikGqv4n6zk3JH+GAwabkg/MV+Z4rwCGkKxiVdZ7S15rQ9Dvgb9WMIoYvFWxtSP pLLERhDr1ocy+Srk7XXh/h4M/5AHaCKz7tlrn38kcM9Xcl6KFxhJ7iAhbyfKsUIlHgJ7 uRpNtdAWNshN1ot/347QUCaoMnUlboIn75xzD2U+IvhERHcdfvOsbYjvJ4iN7ckiGxug uj/Q== ARC-Authentication-Results: i=1; mx.google.com; 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 hp6si16099629ejc.513.2021.05.10.06.06.05; Mon, 10 May 2021 06:06:31 -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; 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 S235910AbhEJND7 (ORCPT + 99 others); Mon, 10 May 2021 09:03:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:38076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240116AbhEJMxD (ORCPT ); Mon, 10 May 2021 08:53:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E2040611BD; Mon, 10 May 2021 12:51:50 +0000 (UTC) Date: Mon, 10 May 2021 14:51:47 +0200 From: Christian Brauner To: "Eric W. Biederman" Cc: Al Viro , Linus Torvalds , Jia He , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Al Viro , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , "Darrick J. Wong" , "Peter Zijlstra (Intel)" , Ira Weiny , Eric Biggers , "Ahmed S. Darwish" , "open list:DOCUMENTATION" , Linux Kernel Mailing List , linux-s390 , linux-fsdevel Subject: Re: [PATCH RFC 1/3] fs: introduce helper d_path_fast() Message-ID: <20210510125147.tkgeurcindldiwxg@wittgenstein> References: <20210508122530.1971-1-justin.he@arm.com> <20210508122530.1971-2-justin.he@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 09, 2021 at 05:58:22PM -0500, Eric W. Biederman wrote: > Al Viro writes: > > > On Sat, May 08, 2021 at 10:46:23PM +0000, Al Viro wrote: > >> On Sat, May 08, 2021 at 03:17:44PM -0700, Linus Torvalds wrote: > >> > On Sat, May 8, 2021 at 2:06 PM Al Viro wrote: > >> > > > >> > > On Sat, May 08, 2021 at 01:39:45PM -0700, Linus Torvalds wrote: > >> > > > >> > > > +static inline int prepend_entries(struct prepend_buffer *b, const struct path *path, const struct path *root, struct mount *mnt) > >> > > > >> > > If anything, s/path/dentry/, since vfsmnt here will be equal to &mnt->mnt all along. > >> > > >> > Too subtle for me. > >> > > >> > And is it? Because mnt is from > >> > > >> > mnt = real_mount(path->mnt); > >> > > >> > earlier, while vfsmount is plain "path->mnt". > >> > >> static inline struct mount *real_mount(struct vfsmount *mnt) > >> { > >> return container_of(mnt, struct mount, mnt); > >> } > > > > Basically, struct vfsmount instances are always embedded into struct mount ones. > > All information about the mount tree is in the latter (and is visible only if > > you manage to include fs/mount.h); here we want to walk towards root, so... > > > > Rationale: a lot places use struct vfsmount pointers, but they've no need to > > access all that stuff. So struct vfsmount got trimmed down, with most of the > > things that used to be there migrating into the containing structure. > > > > [Christian Browner Cc'd] > > BTW, WTF do we have struct mount.user_ns and struct vfsmount.mnt_userns? > > Can they ever be different? Christian? > > I presume you are asking about struct mnt_namespace.user_ns and > struct vfsmount.mnt_userns. > > That must the idmapped mounts work. > > In short mnt_namespace.user_ns is the user namespace that owns > the mount namespace. > > vfsmount.mnt_userns functionally could be reduced to just some struct > uid_gid_map structures hanging off the vfsmount. It's purpose is No. The userns can in the future be used for permission checking when delegating features per mount. > to add a generic translation of uids and gids on from the filesystem > view to the what we want to show userspace. > > That code could probably benefit from some refactoring so it is clearer, > and some serious fixes. I reported it earlier but it looks like there > is some real breakage in chown if you use idmapped mounts. You mentioned something about chown already some weeks ago here [1] and never provided any details or reproducer for it. This code is extensively covered by xfstests and systemd and others are already using it so far without any issues reported by users. If there is an issue, it'd be good to fix them and see the tests changed to cover that particular case. [1]: https://lore.kernel.org/lkml/20210213130042.828076-1-christian.brauner@ubuntu.com/T/#m3a9df31aa183e8797c70bc193040adfd601399ad