Re: [PATCH 17/26] attach_recursive_mnt(): unify the mnt_change_mountpoint() logics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 10, 2025 at 09:21:39AM +0100, Al Viro wrote:
> The logics used for tucking under existing mount differs for original
> and copies; copies do a mount hash lookup to see if mountpoint to be is
> already overmounted, while the original is told explicitly.
> 
> But the same logics that is used for copies works for the original,
> at which point the only place where we get very close to eliminating
> the need of passing 'beneath' flag to attach_recursive_mnt().
> 
> Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Christian Brauner <brauner@xxxxxxxxxx>

>  fs/namespace.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 50c46c084b13..0e43301abb91 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -2675,9 +2675,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
>  	}
>  
>  	mnt_set_mountpoint(dest_mnt, dest_mp, source_mnt);
> -	if (beneath)
> -		mnt_change_mountpoint(source_mnt, smp, top_mnt);
> -	commit_tree(source_mnt);
> +	hlist_add_head(&source_mnt->mnt_hash, &tree_list);

Please add a comment here. Right now it's easy to understand even with
your mnt_change_mountpoint() changes. Afterwards the cases are folded
and imho that leaves readers wondering why that's correct.

>  
>  	hlist_for_each_entry_safe(child, n, &tree_list, mnt_hash) {
>  		struct mount *q;
> -- 
> 2.39.5
> 




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux