mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Automated rollback of changelist 309082540
PiperOrigin-RevId: 313636920
This commit is contained in:
committed by
gVisor bot
parent
2fe14b484a
commit
a8c1b32660
@@ -221,9 +221,6 @@ func mountFlags(opts []string) fs.MountSourceFlags {
|
||||
mf.NoAtime = true
|
||||
case "noexec":
|
||||
mf.NoExec = true
|
||||
case "bind", "rbind":
|
||||
// When options include either "bind" or "rbind",
|
||||
// it's converted to a 9P mount.
|
||||
default:
|
||||
log.Warningf("ignoring unknown mount option %q", o)
|
||||
}
|
||||
@@ -770,10 +767,6 @@ func (c *containerMounter) getMountNameAndOptions(conf *Config, m specs.Mount) (
|
||||
useOverlay bool
|
||||
)
|
||||
|
||||
if isBindMount(m) {
|
||||
m.Type = bind
|
||||
}
|
||||
|
||||
switch m.Type {
|
||||
case devpts.Name, devtmpfs.Name, procvfs2.Name, sysvfs2.Name:
|
||||
fsName = m.Type
|
||||
@@ -801,18 +794,6 @@ func (c *containerMounter) getMountNameAndOptions(conf *Config, m specs.Mount) (
|
||||
return fsName, opts, useOverlay, nil
|
||||
}
|
||||
|
||||
func isBindMount(m specs.Mount) bool {
|
||||
for _, opt := range m.Options {
|
||||
// When options include either "bind" or "rbind", this behaves as
|
||||
// bind mount even if the mount type is equal to a filesystem supported
|
||||
// on runsc.
|
||||
if opt == "bind" || opt == "rbind" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *containerMounter) getMountAccessType(mount specs.Mount) FileAccessType {
|
||||
if hint := c.hints.findMount(mount); hint != nil {
|
||||
return hint.fileAccessType()
|
||||
|
||||
+1
-5
@@ -235,7 +235,7 @@ func (c *containerMounter) prepareMountsVFS2() ([]mountAndFD, error) {
|
||||
fd := -1
|
||||
// Only bind mounts use host FDs; see
|
||||
// containerMounter.getMountNameAndOptionsVFS2.
|
||||
if m.Type == bind || isBindMount(m) {
|
||||
if m.Type == bind {
|
||||
fd = c.fds.remove()
|
||||
}
|
||||
mounts = append(mounts, mountAndFD{
|
||||
@@ -305,10 +305,6 @@ func (c *containerMounter) getMountNameAndOptionsVFS2(conf *Config, m *mountAndF
|
||||
useOverlay bool
|
||||
)
|
||||
|
||||
if isBindMount(m.Mount) {
|
||||
m.Type = bind
|
||||
}
|
||||
|
||||
switch m.Type {
|
||||
case devpts.Name, devtmpfs.Name, proc.Name, sys.Name:
|
||||
fsName = m.Type
|
||||
|
||||
@@ -1537,28 +1537,6 @@ func TestReadonlyMount(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBindMountByOption(t *testing.T) {
|
||||
for _, conf := range configs(t, overlay) {
|
||||
t.Logf("Running test with conf: %+v", conf)
|
||||
|
||||
dir, err := ioutil.TempDir(testutil.TmpDir(), "bind-mount")
|
||||
spec := testutil.NewSpecWithArgs("/bin/touch", path.Join(dir, "file"))
|
||||
if err != nil {
|
||||
t.Fatalf("ioutil.TempDir() failed: %v", err)
|
||||
}
|
||||
spec.Mounts = append(spec.Mounts, specs.Mount{
|
||||
Destination: dir,
|
||||
Source: dir,
|
||||
Type: "none",
|
||||
Options: []string{"rw", "bind"},
|
||||
})
|
||||
|
||||
if err := run(spec, conf); err != nil {
|
||||
t.Fatalf("error running sandbox: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestAbbreviatedIDs checks that runsc supports using abbreviated container
|
||||
// IDs in place of full IDs.
|
||||
func TestAbbreviatedIDs(t *testing.T) {
|
||||
|
||||
@@ -1394,7 +1394,7 @@ func TestMultiContainerSharedMountUnsupportedOptions(t *testing.T) {
|
||||
Destination: "/mydir/test",
|
||||
Source: "/some/dir",
|
||||
Type: "tmpfs",
|
||||
Options: []string{"rw", "relatime"},
|
||||
Options: []string{"rw", "rbind", "relatime"},
|
||||
}
|
||||
podSpec[0].Mounts = append(podSpec[0].Mounts, mnt0)
|
||||
|
||||
|
||||
@@ -311,19 +311,7 @@ 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 {
|
||||
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)
|
||||
return m.Type == "bind" && m.Source != "" && IsSupportedDevMount(m)
|
||||
}
|
||||
|
||||
// IsSupportedDevMount returns true if the mount is a supported /dev mount.
|
||||
|
||||
Reference in New Issue
Block a user