Skip to content
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

overlay: drop check for mount_program AND force_mask #1970

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,6 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
return nil, err
}
} else {
if opts.forceMask != nil {
return nil, errors.New("'force_mask' is supported only with 'mount_program'")
}
// check if they are running over btrfs, aufs, overlay, or ecryptfs
switch fsMagic {
case graphdriver.FsMagicAufs, graphdriver.FsMagicOverlay, graphdriver.FsMagicEcryptfs:
Expand Down Expand Up @@ -985,6 +982,10 @@ func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts
}
}

if d.options.forceMask != nil && d.options.mountProgram == "" {
return fmt.Errorf("overlay: force_mask option for writeable layers is only supported with a mount_program")
}

if _, ok := opts.StorageOpt["size"]; !ok {
if opts.StorageOpt == nil {
opts.StorageOpt = map[string]string{}
Expand Down
10 changes: 2 additions & 8 deletions drivers/overlay/overlay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package overlay

import (
"os"
"os/exec"
"testing"

graphdriver "github.com/containers/storage/drivers"
Expand Down Expand Up @@ -42,15 +41,10 @@ func skipIfNaive(t *testing.T) {
// This test is placed before TestOverlaySetup() because it uses driver options
// different from the other tests.
func TestContainersOverlayXattr(t *testing.T) {
path, err := exec.LookPath("fuse-overlayfs")
if err != nil {
t.Skipf("fuse-overlayfs unavailable")
}

driver := graphtest.GetDriver(t, driverName, "force_mask=700", "mount_program="+path)
driver := graphtest.GetDriver(t, driverName, "force_mask=700")
defer graphtest.PutDriver(t)
require.NoError(t, driver.Create("lower", "", nil))
graphtest.ReconfigureDriver(t, driverName, "mount_program="+path)
graphtest.ReconfigureDriver(t, driverName)
require.NoError(t, driver.Create("upper", "lower", nil))

root, err := driver.Get("upper", graphdriver.MountOpts{})
Expand Down