overlay2: doesSupportNativeDiff: add fast path for userns
When running in userns, returns error (i.e. "use naive, not native") immediately. No substantial change to the logic. Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
dd97134232
commit
67aa418df2
1 changed files with 8 additions and 0 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"path/filepath"
|
||||
"syscall"
|
||||
|
||||
"github.com/containerd/containerd/sys"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
|
@ -19,7 +20,14 @@ import (
|
|||
// which copies up the opaque flag when copying up an opaque
|
||||
// directory or the kernel enable CONFIG_OVERLAY_FS_REDIRECT_DIR.
|
||||
// When these exist naive diff should be used.
|
||||
//
|
||||
// When running in a user namespace, returns errRunningInUserNS
|
||||
// immediately.
|
||||
func doesSupportNativeDiff(d string) error {
|
||||
if sys.RunningInUserNS() {
|
||||
return errors.New("running in a user namespace")
|
||||
}
|
||||
|
||||
td, err := ioutil.TempDir(d, "opaque-bug-check")
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue