Closed axet closed 2 years ago
I'll have to look into this, that definitely shouldn't be happening.
As a temporary fix, you should be able to disable copy-on-write for the whole swapfile directory. The warning will probably still occur, but the swapfile should be successfully enabled.
chattr +C /var/lib/swapspace
axet@axet-laptop:~$ sudo chattr +C /var/lib/swapspace
chattr: Invalid argument while setting flags on /var/lib/swapspace
axet@axet-laptop:~$
I guess this is 100% debian issue.
Basic question: is that directory actually on btrfs?
You can use df -T /var/lib/swapspace
to verify.
Not that simple ;)
axet@axet-laptop:~$ df -T /var/lib/swapspace
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/mapper/luks btrfs 361487360 70731556 290052396 20% /
axet@axet-laptop:~$
I have not been able to reproduce this in a fresh Debian 11 install on BTRFS with the same kernel and Swapspace versions.
Do you know what BTRFS mount options you’re using? They should be in /etc/fstab
Jacob
On Oct 14, 2021, at 00:37, axet @.***> wrote:
Not that simple ;)
@.:~$ df -T /var/lib/swapspace Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/mapper/luks btrfs 361487360 70731556 290052396 20% / @.:~$ — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
UUID="a90dee0b-b4d0-429f-a078-8eda0b36abcd" / btrfs defaults 0 1
I see:
axet@axet-laptop:~$ sudo lsattr /var/lib/|grep swap
--------c------------- /var/lib/swapspace
axet@axet-laptop:~$ sudo chattr -c /var/lib/swapspace
axet@axet-laptop:~$ sudo chattr +C /var/lib/swapspace
axet@axet-laptop:~$
I suggest auto remove compression flag from /var/lib/swapspace folder automatically if present by swapspace service.
This approach has now been taken in the dir_attr branch. More testing is required before I can release it as is, but I can confirm that it fixes the problem seen in this issue.
Removing '-c' from swaspace folder not necessary. You can just remove compression flag from file it self:
truncate -s 0 swapfile1 # create zero length file
chattr -c swapfile1 # drop compression flag
chattr +C swapfile1 # drop COW
btrfs property set swapfile1 compression none # force no compression
dd if=/dev/zero of=swapfile1 bs=1G count=1 # fill up
fallocate -l 5G swapfile1 # or use fallocate instead dd
EDIT: suggesting following patch:
@@ -452,6 +455,17 @@ int set_no_cow(int fd)
}
else return err;
}
+ attr &= ~FS_COMPR_FL;
+ err = ioctl(fd, FS_IOC_SETFLAGS, &attr);
+ if (err != 0)
+ {
+ if (errno == ENOTSUP)
+ {
+ nocow_ok = false;
+ logm(LOG_NOTICE, "removing COMPR attribute not supported!");
+ }
+ else return err;
+ }
attr |= FS_NOCOW_FL;
err = ioctl(fd, FS_IOC_SETFLAGS, &attr);
if (err != 0)
I've tested it. It works fine even with '+c' flag set on /var/lib/swapspace
Hello!
Recent debian kernel version of linux-image-amd64 (5.14.9-2) causing following error in syslog:
This is unreleased and new debian (bookworm) with: swapspace 1.17-1