Sfoglia il codice sorgente

d/graphdriver/copy: support src fs w/o xattr support

Treat copying extended attributes from a source filesystem which does
not support extended attributes as a no-op, same as if the file did not
possess the extended attribute. Only fail copying extended attributes if
the source file has the attribute and the destination filesystem does
not support xattrs.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Cory Snider 2 anni fa
parent
commit
2b6761fd3e
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      daemon/graphdriver/copy/copy.go

+ 6 - 0
daemon/graphdriver/copy/copy.go

@@ -5,6 +5,7 @@ package copy // import "github.com/docker/docker/daemon/graphdriver/copy"
 
 
 import (
 import (
 	"container/list"
 	"container/list"
+	"errors"
 	"fmt"
 	"fmt"
 	"io"
 	"io"
 	"os"
 	"os"
@@ -90,6 +91,11 @@ func legacyCopy(srcFile io.Reader, dstFile io.Writer) error {
 func copyXattr(srcPath, dstPath, attr string) error {
 func copyXattr(srcPath, dstPath, attr string) error {
 	data, err := system.Lgetxattr(srcPath, attr)
 	data, err := system.Lgetxattr(srcPath, attr)
 	if err != nil {
 	if err != nil {
+		if errors.Is(err, syscall.EOPNOTSUPP) {
+			// Task failed successfully: there is no xattr to copy
+			// if the source filesystem doesn't support xattrs.
+			return nil
+		}
 		return err
 		return err
 	}
 	}
 	if data != nil {
 	if data != nil {