Skip to content

Commit

Permalink
Merge pull request #1970 from giuseppe/drop-check-for-mount-program-a…
Browse files Browse the repository at this point in the history
…nd-force-mask

overlay: drop check for mount_program AND force_mask
  • Loading branch information
openshift-merge-bot[bot] authored Jun 20, 2024
2 parents 768258b + e6e9715 commit c3d0daa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 4 additions & 3 deletions drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,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 @@ -984,6 +981,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

0 comments on commit c3d0daa

Please sign in to comment.