Skip to content

Conversation

evanphx
Copy link
Contributor

@evanphx evanphx commented Feb 27, 2025

The current behavior disallows any mount having (r)shared on it because by default, the root is set with MS_SLAVE|MS_REC, which disallows sub-dirs from having a different propagation.

Projects have been working around this by setting the RootfsPropogation to "shared", to override the default
(https://github.com/containerd/nerdctl/blob/main/pkg/mountutil/mountutil_linux.go#L185-L193).

This patch makes a reasonable attempt to make the functionality work without touching RootfsPropogation.

The current behavior disallows any mount have (r)shared on it because by
default, the root is set with MS_SLAVE, which disallows sub-dirs from
having a different propagation.

Projects have been working around this by setting the RootfsPropogation
to "shared", to override the default
(https://github.com/containerd/nerdctl/blob/main/pkg/mountutil/mountutil_linux.go#L185-L193).

This patch makes a reasonable attempt to make the functionality work
without touching RootfsPropogation.

Signed-off-by: Evan Phoenix <[email protected]>
@evanphx
Copy link
Contributor Author

evanphx commented Feb 28, 2025

Looking at the code I've edited, the code resets it to PRIVATE below. Can someone chime in on what the code setting to SLAVE is meant to do? Totally likely my change isn't right because I'm not sure I understand what the purpose is of setting SLAVE is.

@rata
Copy link
Member

rata commented Apr 2, 2025

Just curious, why not set the propagation you want for the rootfs in the config.json, as nerdctl is doing in the link you point?

@rata
Copy link
Member

rata commented Apr 2, 2025

Can someone chime in on what the code setting to SLAVE is meant to do?

I guess @kolyshkin or @cyphar are the right persons to answer this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants