snapshots|pkg: umount without DETACH and nosync after umount
Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
parent
72b7d16505
commit
6dfb16f99a
@ -28,6 +28,8 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const umountflags int = 0
|
||||||
|
|
||||||
var rootEnabled bool
|
var rootEnabled bool
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright The containerd Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package testutil
|
|
||||||
|
|
||||||
import "golang.org/x/sys/unix"
|
|
||||||
|
|
||||||
const umountflags int = unix.MNT_DETACH
|
|
@ -1,22 +0,0 @@
|
|||||||
//go:build !linux
|
|
||||||
// +build !linux
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright The containerd Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package testutil
|
|
||||||
|
|
||||||
const umountflags int = 0
|
|
@ -102,7 +102,7 @@ func boltSnapshotter(t *testing.T) func(context.Context, string) (snapshots.Snap
|
|||||||
if err := snapshotter.Close(); err != nil {
|
if err := snapshotter.Close(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err := mount.UnmountAll(root, unix.MNT_DETACH)
|
err := mount.UnmountAll(root, 0)
|
||||||
if cerr := loop.Close(); cerr != nil {
|
if cerr := loop.Close(); cerr != nil {
|
||||||
err = fmt.Errorf("device cleanup failed: %w", cerr)
|
err = fmt.Errorf("device cleanup failed: %w", cerr)
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ import (
|
|||||||
"github.com/containerd/continuity/fs/fstest"
|
"github.com/containerd/continuity/fs/fstest"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const umountflags int = 0
|
||||||
|
|
||||||
func applyToMounts(m []mount.Mount, work string, a fstest.Applier) (err error) {
|
func applyToMounts(m []mount.Mount, work string, a fstest.Applier) (err error) {
|
||||||
td, err := os.MkdirTemp(work, "prepare")
|
td, err := os.MkdirTemp(work, "prepare")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright The containerd Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package testsuite
|
|
||||||
|
|
||||||
import "golang.org/x/sys/unix"
|
|
||||||
|
|
||||||
const umountflags int = unix.MNT_DETACH
|
|
@ -1,21 +0,0 @@
|
|||||||
//go:build !linux
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright The containerd Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package testsuite
|
|
||||||
|
|
||||||
const umountflags int = 0
|
|
@ -959,7 +959,6 @@ func check128LayersMount(name string) func(ctx context.Context, t *testing.T, sn
|
|||||||
t.Fatalf("[layer %d] preparing doesn't equal to flat after apply: %+v", i, err)
|
t.Fatalf("[layer %d] preparing doesn't equal to flat after apply: %+v", i, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sync()
|
|
||||||
testutil.Unmount(t, preparing)
|
testutil.Unmount(t, preparing)
|
||||||
|
|
||||||
parent = filepath.Join(work, fmt.Sprintf("committed-%d", i))
|
parent = filepath.Join(work, fmt.Sprintf("committed-%d", i))
|
||||||
|
@ -20,8 +20,6 @@ package testsuite
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func clearMask() func() {
|
func clearMask() func() {
|
||||||
@ -30,7 +28,3 @@ func clearMask() func() {
|
|||||||
syscall.Umask(oldumask)
|
syscall.Umask(oldumask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func sync() {
|
|
||||||
unix.Sync()
|
|
||||||
}
|
|
||||||
|
@ -19,5 +19,3 @@ package testsuite
|
|||||||
func clearMask() func() {
|
func clearMask() func() {
|
||||||
return func() {}
|
return func() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
func sync() {}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user