Selaa lähdekoodia

overlayutils/userxattr.go: add "fast path" for kernel >= 5.11.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Akihiro Suda 4 vuotta sitten
vanhempi
commit
a8008f7313
1 muutettua tiedostoa jossa 6 lisäystä ja 2 poistoa
  1. 6 2
      daemon/graphdriver/overlayutils/userxattr.go

+ 6 - 2
daemon/graphdriver/overlayutils/userxattr.go

@@ -27,6 +27,7 @@ import (
 
 
 	"github.com/containerd/containerd/mount"
 	"github.com/containerd/containerd/mount"
 	"github.com/containerd/containerd/sys"
 	"github.com/containerd/containerd/sys"
+	"github.com/docker/docker/pkg/parsers/kernel"
 	"github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus"
 )
 )
 
 
@@ -56,10 +57,13 @@ func NeedsUserXAttr(d string) (bool, error) {
 		return false, nil
 		return false, nil
 	}
 	}
 
 
-	// TODO: add fast path for kernel >= 5.11 .
+	// Fast path for kernel >= 5.11 .
 	//
 	//
 	// Keep in mind that distro vendors might be going to backport the patch to older kernels.
 	// Keep in mind that distro vendors might be going to backport the patch to older kernels.
-	// So we can't completely remove the check.
+	// So we can't completely remove the "slow path".
+	if kernel.CheckKernelVersion(5, 11, 0) {
+		return true, nil
+	}
 
 
 	tdRoot := filepath.Join(d, "userxattr-check")
 	tdRoot := filepath.Join(d, "userxattr-check")
 	if err := os.RemoveAll(tdRoot); err != nil {
 	if err := os.RemoveAll(tdRoot); err != nil {