Proposal: Allow mounting and bind mounting over symlinks – flag to not expand symlinks
Morning all!
I would like to propose adding a flag to the syscall underlying mount(2) that disables symlink expansion.
The motivating use case for this is as follows: I am trying to set up a netns namespace that requires a specific DNS setup, to this end, I am creating a mount namespace and replacing /etc/resolve.conf. Unfortunately, resolv.conf is a symlink provided by systemd-resolved. Bind mounting over said file with my replacement is impossible: With -c option, the mount command actually targets /etc/resolv.conf instead of the file it's pointing to, but the kernel expands it internally and seems to mount over the file being pointed to.
I highly similar use cases exist.
I have tried the nosymfollow option, which did not work. I think it affects only how symlinks are handled once the fs is mounted.
Best,
Karolin Varner