1
0
mirror of https://github.com/lxc/incus.git synced 2026-02-05 09:46:19 +01:00

shared/idmap: Skip xattrs on EINVAL

When parsing extended attributes, we may be getting EINVAL when run on ZFS.

This appears to be when dealing with ZFS namespaced xattrs and despite
being real root with all capabilities, there appears to be no way to
read or even clear those attributes.

So instead of crashing mid-shift, let's just log them and move on.

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Sponsored-by: https://webdock.io
This commit is contained in:
Stéphane Graber
2025-09-24 02:16:20 -04:00
parent 4b689e28c9
commit f0e60843f0

View File

@@ -9,6 +9,8 @@ import (
"github.com/pkg/xattr"
"golang.org/x/sys/unix"
"github.com/lxc/incus/v6/shared/logger"
)
// The functions below are verbatim copies of the functions found in the internal package.
@@ -33,6 +35,11 @@ func getAllXattr(path string) (map[string]string, error) {
for _, xattrName := range xattrNames {
value, err := xattr.LGet(path, xattrName)
if err != nil {
if errors.Is(err, unix.EINVAL) {
logger.Warn("Skipping unreadable xattr during shift", logger.Ctx{"path": path, "xattr": xattrName})
continue
}
return nil, fmt.Errorf("Failed getting %q extended attribute from %q: %w", xattrName, path, err)
}