tree-wide: Handle EINVAL as not supported for chattr_xxx()
F2FS returns EINVAL from FS_IOC_SETFLAGS when trying to set FS_NOCOW_FL. Let's handle this by treating EINVAL as not supported. While we're at it, make sure we use ERRNO_IS_IOCTL_NOT_SUPPORTED() across the tree instead of ERRNO_IS_NOT_SUPPORTED() when calling any of the chattr_xxx() functions. Fixes #37593
This commit is contained in:
+1
-1
@@ -774,7 +774,7 @@ static int prepare_nocow(int fdf, const char *from, int fdt, unsigned *chattr_ma
|
||||
return 0;
|
||||
|
||||
r = read_attr_at(fdf, from, &attrs);
|
||||
if (r < 0 && !ERRNO_IS_NOT_SUPPORTED(r) && r != -ELOOP) /* If the source is a symlink we get ELOOP */
|
||||
if (r < 0 && !ERRNO_IS_IOCTL_NOT_SUPPORTED(r) && r != -ELOOP) /* If the source is a symlink we get ELOOP */
|
||||
return r;
|
||||
|
||||
if (FLAGS_SET(attrs, FS_NOCOW_FL)) {
|
||||
|
||||
@@ -232,7 +232,7 @@ int import_set_nocow_and_log(int fd, const char *path) {
|
||||
r = chattr_fd(fd, FS_NOCOW_FL, FS_NOCOW_FL);
|
||||
if (r < 0)
|
||||
return log_full_errno(
|
||||
ERRNO_IS_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING,
|
||||
ERRNO_IS_IOCTL_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING,
|
||||
r, "Failed to set file attributes on %s: %m", path);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user