Fix QAT plugin image pull failed

Fix several image pull failure issue caused by a containerd chmod
issue resolve by upstream commit e2269f2.

Original commit message:

handleLChmod() does not properly check that files behind the
handlinks exist before calling os.Chmod(). We've seen base images
where this results in "no such file or directory" error from
os.Chmod() when unpacking the image.

To keep the existing logic but fix the problem, this commit simply
skips IsNotExist error.

Closes-bug: 1869236

Change-Id: I2e77adbf89ad5505f2d7127a3f06ccfb805c0f24
Signed-off-by: Mingyuan Qi <mingyuan.qi@intel.com>
This commit is contained in:
Mingyuan Qi 2020-04-10 05:29:19 +00:00
parent 045ba2a0e2
commit 5694c72218
2 changed files with 35 additions and 0 deletions

View File

@ -14,6 +14,7 @@ Source2: crictl-v1.16.0-linux-amd64.tar.gz
Source3: crictl.yaml
Source4: containerd.service
Patch5: 0001-customize-containerd-for-StarlingX.patch
Patch6: 0002-archive-skip-chmod-IsNotExist-error.patch
URL: https://www.starlingx.io
Vendor: StarlingX
Packager: StarlingX
@ -54,6 +55,7 @@ low-level storage and network attachments, etc.
%setup -q -c -n src -a 1
%setup -q -c -T -D -n src -a 2
%patch5 -p1
%patch6 -p1
%build
# build containerd

View File

@ -0,0 +1,33 @@
From e2269f2ae0a8bb996b13d98ed6ffbdad7cdafd0f Mon Sep 17 00:00:00 2001
From: Mikko Ylinen <mikko.ylinen@intel.com>
Date: Mon, 23 Mar 2020 20:52:14 +0200
Subject: [PATCH] archive: skip chmod IsNotExist error
handleLChmod() does not properly check that files behind the handlinks exist
before calling os.Chmod(). We've seen base images where this results in
"no such file or directory" error from os.Chmod() when unpacking the image.
To keep the existing logic but fix the problem, this commit simply skips
IsNotExist error.
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
---
containerd/archive/tar_unix.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/containerd/archive/tar_unix.go b/containerd/archive/tar_unix.go
index d081351..2134083 100644
--- a/containerd/archive/tar_unix.go
+++ b/containerd/archive/tar_unix.go
@@ -125,7 +125,7 @@ func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error {
func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error {
if hdr.Typeflag == tar.TypeLink {
if fi, err := os.Lstat(hdr.Linkname); err == nil && (fi.Mode()&os.ModeSymlink == 0) {
- if err := os.Chmod(path, hdrInfo.Mode()); err != nil {
+ if err := os.Chmod(path, hdrInfo.Mode()); err != nil && !os.IsNotExist(err) {
return err
}
}
--
1.8.3.1