-
Notifications
You must be signed in to change notification settings - Fork 98
Conditionally mount the host's /dev over the container's /dev #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c75825c to
0f2aa79
Compare
jgehrcke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contingent on devRoot == "/"
makes sense!
Thanks, Kevin. I agree that a tiny patch here is a smart path forward (de-risking the introduction of new problems)
| return helper(root) | ||
| } | ||
|
|
||
| // conditionallyBindMountHostDev bind mounts hostDevPath over /dev when devRoot is "/". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Should we add a note as to why this is required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Will add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| nvidiaCapsDeviceName = "nvidia-caps" | ||
| nvidiaCapsImexChannelsDeviceName = "nvidia-caps-imex-channels" | ||
| nvidiaCapFabricImexMgmtPath = "/proc/driver/nvidia/capabilities/fabric-imex-mgmt" | ||
| hostDevPath = "/host/dev" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Is this hostDevContainerPath?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, Evan!
| mounter := mount.New(mountExecutable) | ||
|
|
||
| // Bind mount hostDevPath over /dev | ||
| if err := mounter.Mount(hostDevPath, "/dev", "", []string{"bind"}); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we concerned that this leaks mounts to the host? Is this mount cleaned up if the container is terminated? (e.g. if mount propagation is bidirectional)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The host dev folder isn't mounted bidirectionally, but regardless I don't think anything will be leaked.
Unlike with the driver container where we perform mounts into a path that (in itself) has been hostPath-mounted into the container -- the bind mount we are performing here is over a path solely within the mount namespace of the container.
0f2aa79 to
2b83dad
Compare
|
Pushed changes to address comments from @elezar |
2b83dad to
ee4efec
Compare
Currently, in the compute domain driver, we unconditionally mount the host's /dev over the container's /dev regardless of what the devRoot of the GPU driver is. This change was introduced in NVIDIA#307. Unfortunately, this causes some problems on certain systems as described in NVIDIA#477. This patch makes this mount contingent on devRoot == "/" (which is the only case where we actually ever wanted / needed to have this mount in the first place. Signed-off-by: Kevin Klues <[email protected]>
ee4efec to
9797d24
Compare
Currently, in the compute domain driver, we unconditionally mount the host's /dev over the container's /dev regardless of what the devRoot of the GPU driver is. This change was introduced in #307.
Unfortunately, this causes some problems on certain systems as described in #477.
This patch makes this mount contingent on devRoot == "/" (which is the only case where we actually ever wanted / needed to have this mount in the first place.
Fixes: #477