Skip to content

Commit

Permalink
Merge pull request #7646 from dcantah/cp-userxattr-1.6
Browse files Browse the repository at this point in the history
[release/1.6] overlayutils: Add fastpath for userxattr check
  • Loading branch information
kzys committed Nov 9, 2022
2 parents f69fbac + 5af8d89 commit 6c41694
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions snapshots/overlay/overlayutils/check.go
Expand Up @@ -24,6 +24,7 @@ import (
"os"
"path/filepath"

kernel "github.com/containerd/containerd/contrib/seccomp/kernelversion"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/mount"
"github.com/containerd/containerd/pkg/userns"
Expand Down Expand Up @@ -113,10 +114,14 @@ func NeedsUserXAttr(d string) (bool, error) {
return false, nil
}

// TODO: add fast path for kernel >= 5.11 .
// Fast path on kernels >= 5.11
//
// Keep in mind that distro vendors might be going to backport the patch to older kernels.
// So we can't completely remove the check.
// Keep in mind that distro vendors might be going to backport the patch to older kernels
// so we can't completely remove the "slow path".
fiveDotEleven := kernel.KernelVersion{Kernel: 5, Major: 11}
if ok, err := kernel.GreaterEqualThan(fiveDotEleven); err == nil && ok {
return true, nil
}

tdRoot := filepath.Join(d, "userxattr-check")
if err := os.RemoveAll(tdRoot); err != nil {
Expand Down

0 comments on commit 6c41694

Please sign in to comment.