Merge pull request #21598 from DaanDeMeyer/journald-file

journal: Fix re-enabling COW for archived journal files on BTRFS
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-12-07 07:35:34 +01:00
committed by GitHub
22 changed files with 793 additions and 676 deletions
+19 -5
View File
@@ -59,11 +59,25 @@ int chattr_full(const char *path,
}
if (ioctl(fd, FS_IOC_SETFLAGS, &new_attr) >= 0) {
if (ret_previous)
*ret_previous = old_attr;
if (ret_final)
*ret_final = new_attr;
return 1;
unsigned attr;
/* Some filesystems (BTRFS) silently fail when a flag cannot be set. Let's make sure our
* changes actually went through by querying the flags again and verifying they're equal to
* the flags we tried to configure. */
if (ioctl(fd, FS_IOC_GETFLAGS, &attr) < 0)
return -errno;
if (new_attr == attr) {
if (ret_previous)
*ret_previous = old_attr;
if (ret_final)
*ret_final = new_attr;
return 1;
}
/* Trigger the fallback logic. */
errno = EINVAL;
}
if ((errno != EINVAL && !ERRNO_IS_NOT_SUPPORTED(errno)) ||