diff options
author | moricho <ikeda.morito@gmail.com> | 2020-04-22 15:04:18 +0900 |
---|---|---|
committer | moricho <ikeda.morito@gmail.com> | 2020-04-26 17:24:34 +0900 |
commit | fc53d6436776d5de052075e98f44417f04ced7e7 (patch) | |
tree | f4f0c237595b0a6d9745cf6870abc4fb2917b92f /runsc/specutils/specutils.go | |
parent | 0b3166f6243472fbb72cc749c57d3a59aa481979 (diff) |
refactor and add test for bindmount
Signed-off-by: moricho <ikeda.morito@gmail.com>
Diffstat (limited to 'runsc/specutils/specutils.go')
-rw-r--r-- | runsc/specutils/specutils.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/runsc/specutils/specutils.go b/runsc/specutils/specutils.go index 837d5e238..202518b58 100644 --- a/runsc/specutils/specutils.go +++ b/runsc/specutils/specutils.go @@ -311,7 +311,19 @@ func capsFromNames(names []string, skipSet map[linux.Capability]struct{}) (auth. // Is9PMount returns true if the given mount can be mounted as an external gofer. func Is9PMount(m specs.Mount) bool { - return m.Type == "bind" && m.Source != "" && IsSupportedDevMount(m) + var isBind bool + switch m.Type { + case "bind": + isBind = true + default: + for _, opt := range m.Options { + if opt == "bind" || opt == "rbind" { + isBind = true + break + } + } + } + return isBind && m.Source != "" && IsSupportedDevMount(m) } // IsSupportedDevMount returns true if the mount is a supported /dev mount. |