Skip to content

Commit 8296826

Browse files
committed
specconv: always set "type: bind" in case of MS_BIND
We discovered in umoci that setting a dummy type of "none" would result in file-based bind-mounts no longer working properly, which is caused by a restriction for when specconv will change the device type to "bind" to work around rootfs_linux.go's ... issues. However, bind-mounts don't have a type (and Linux will ignore any type specifier you give it) because the type is copied from the source of the bind-mount. So we should always overwrite it to avoid user confusion. Signed-off-by: Aleksa Sarai <[email protected]>
1 parent 029124d commit 8296826

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libcontainer/specconv/spec_linux.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,10 @@ func createLibcontainerMount(cwd string, m specs.Mount) *configs.Mount {
277277
source := m.Source
278278
device := m.Type
279279
if flags&unix.MS_BIND != 0 {
280-
if device == "" {
281-
device = "bind"
282-
}
280+
// Any "type" the user specified is meaningless (and ignored) for
281+
// bind-mounts -- so we set it to "bind" because rootfs_linux.go
282+
// (incorrectly) relies on this for some checks.
283+
device = "bind"
283284
if !filepath.IsAbs(source) {
284285
source = filepath.Join(cwd, m.Source)
285286
}

0 commit comments

Comments
 (0)