Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
5 changes: 3 additions & 2 deletions internal/lib/sandbox/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,9 @@ func (s *Sandbox) UnmountShm() error {
return nil
}

// try to unmount, ignoring "not mounted" (EINVAL) error
if err := unix.Unmount(fp, unix.MNT_DETACH); err != nil && err != unix.EINVAL {
// try to unmount, ignoring "not mounted" (EINVAL) error and
// "already unmounted" (ENOENT) error
if err := unix.Unmount(fp, unix.MNT_DETACH); err != nil && err != unix.EINVAL && err != unix.ENOENT {
return errors.Wrapf(err, "unable to unmount %s", fp)
}

Expand Down
5 changes: 1 addition & 4 deletions test/stats.bats
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ function teardown() {

@test "container stats" {
# given
python -c 'import json,sys;obj=json.load(sys.stdin);obj["name"] = ["podsandbox1-sleep2"];obj["metadata"]["name"] = "podsandbox1-sleep2"; json.dump(obj, sys.stdout)' \
< "$TESTDATA"/container_sleep.json > "$TESTDIR"/container_sleep2.json

pod_id=$(crictl runp "$TESTDATA"/sandbox_config.json)

ctr1_id=$(crictl create "$pod_id" "$TESTDATA"/container_sleep.json "$TESTDATA"/sandbox_config.json)
crictl start "$ctr1_id"

ctr2_id=$(crictl create "$pod_id" "$TESTDIR"/container_sleep2.json "$TESTDATA"/sandbox_config.json)
ctr2_id=$(crictl create "$pod_id" "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json)
crictl start "$ctr2_id"

# when
Expand Down