On Wed, Jun 11, 2025 at 06:51:36PM +0100, Al Viro wrote: > On Wed, Jun 11, 2025 at 12:31:54PM +0200, Christian Brauner wrote: > > On Tue, Jun 10, 2025 at 09:17:58AM +0100, Al Viro wrote: > > > The next pile of mount massage; it will grow - there will be > > > further modifications, as well as fixes and documentation, but this is > > > the subset I've got in more or less settled form right now. > > > > > > Review and testing would be very welcome. > > > > > > This series (-rc1-based) sits in > > > git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git #work.mount > > > individual patches in followups. > > > > > > Rough overview: > > > > > > Part 1: trivial cleanups and helpers: > > > > > > 1) copy_tree(): don't set ->mnt_mountpoint on the root of copy > > > Ancient bogosity, fortunately harmless, but confusing. > > > 2) constify mnt_has_parent() > > > 3) pnode: lift peers() into pnode.h > > > 4) new predicate: mount_is_ancestor() > > > Incidentally, I wonder if the "early bail out on move > > > of anon into the same anon" was not due to (now eliminated) > > > corner case in loop detection... Christian? > > > > No, that wasn't the reason. When moving mounts between anonymous mount > > namespaces I wanted a very simple visual barrier that moving mounts into > > the same anonymous mount namespace is not possible. > > > > I even mentioned in the comment that this would be caught later but that > > I like it being explicitly checked for. > > OK... AFAICS, the way those tests were done it would not be caught later. > At the merge time loop detection had been the same as in mainline now: > for (; mnt_has_parent(p); p = p->mnt_parent) > if (p == old) > goto out; > and that will never reach that goto out if mnt_has_parent(old) is false. > The early bailout avoided that problem, thus the question if that's where > it came from... Yeah, I mean doing it your way is obviously fine and correct.