Skip to content

Commit f816d12

Browse files
authored
Merge pull request #663 from elezar/fix-libnvidia-allocator-duplicate-mount
Exclude libnvidia-allocator from graphics mounts
2 parents 3b87237 + 7dff5b1 commit f816d12

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

internal/discover/graphics.go

+21
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,27 @@ func newGraphicsLibrariesDiscoverer(logger logger.Interface, driver *root.Driver
146146
}
147147
}
148148

149+
// Mounts discovers the required libraries and filters out libnvidia-allocator.so.
150+
// The library libnvidia-allocator.so is already handled by either the *.RM_VERSION
151+
// injection or by libnvidia-container. We therefore filter it out here as a
152+
// workaround for the case where libnvidia-container will re-mount this in the
153+
// container, which causes issues with shared mount propagation.
154+
func (d graphicsDriverLibraries) Mounts() ([]Mount, error) {
155+
mounts, err := d.Discover.Mounts()
156+
if err != nil {
157+
return nil, fmt.Errorf("failed to get library mounts: %v", err)
158+
}
159+
160+
var filtered []Mount
161+
for _, mount := range mounts {
162+
if d.isDriverLibrary(filepath.Base(mount.Path), "libnvidia-allocator.so") {
163+
continue
164+
}
165+
filtered = append(filtered, mount)
166+
}
167+
return filtered, nil
168+
}
169+
149170
// Create necessary library symlinks for graphics drivers
150171
func (d graphicsDriverLibraries) Hooks() ([]Hook, error) {
151172
mounts, err := d.Discover.Mounts()

internal/discover/graphics_test.go

+1-8
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ func TestGraphicsLibrariesDiscoverer(t *testing.T) {
6262
return mounts, nil
6363
},
6464
},
65-
expectedMounts: []Mount{
66-
{
67-
Path: "/usr/lib64/libnvidia-allocator.so.123.45.67",
68-
},
69-
},
65+
expectedMounts: nil,
7066
expectedHooks: []Hook{
7167
{
7268
Lifecycle: "createContainer",
@@ -121,9 +117,6 @@ func TestGraphicsLibrariesDiscoverer(t *testing.T) {
121117
},
122118
},
123119
expectedMounts: []Mount{
124-
{
125-
Path: "/usr/lib64/libnvidia-allocator.so.123.45.67",
126-
},
127120
{
128121
Path: "/usr/lib64/libnvidia-vulkan-producer.so.123.45.67",
129122
},

0 commit comments

Comments
 (0)