static int attach_recursive_mnt(struct vfsmount *source_mnt, struct nameidata *nd, struct nameidata *parent_nd) {

LIST_HEAD(tree_list); struct vfsmount *dest_mnt = nd->mnt; struct dentry *dest_dentry = nd->detnry; struct vfsmount *child, *p;

if (propagate_mnt(dest_mnt, dest_dentry, source_mnt, &tree_list)) return -EINVAL;

propagate_mnt iterates over all slave and shared mounts of the mount destination and mounts the new filesystem into them using mnt_set_montpoint. All mount points that are affected by this are returned in tree_list.

17Since the function has already returned to the caller in the case of shared mounts, only these mount types remain and can be different from MS_SLAVE in the if conditional.

18Note that we also perform a slight simplification this time since we only consider add mounts, but no move mounts where an existing mount is shifted from one place in the filesystem hierarchy to another.

If the destination mount point is a shared mount, then the new mount and all its submounts need to become shared as well:

Continue reading here: Fsnamespacec

Was this article helpful?

0 0