On 21.01.20 г. 12:59 ч., Robbie Smith wrote:
> I think I have a hunch as to why this issue has occurred. I've had two
> btrfs partition failures, and both times it was upon resuming from
> hibernation. The key file for the encrypted swap was stored in
> /root/key-file, and the openswap hook unlocks the encrypted root,
> mounts it, reads the keyfile for the swap partition, and then unmounts
> it again. Could this action be causing the transid to be incremented
> somehow?
>
>> /etc/initcpio/hooks/openswap
>> run_hook ()
>> {
>> ## Optional: To avoid race conditions
>> x=0;
>> while [ ! -b /dev/mapper/cryptroot ] && [ $x -le 10 ]; do
>> x=$((x+1))
>> sleep .2
>> done
>> ## End of optional
>>
>> mkdir crypto_key_device
>> mount /dev/mapper/cryptroot crypto_key_device
>> cryptsetup open --key-file crypto_key_device/root/key-file /dev/disk/by-uuid/<UUID> swapDevice
>> umount crypto_key_device
>> }
>
> The very first line of swsusp[1] has a big fat warning about touching
> data on the disk between suspend and resume, and in hindsight I
> imagine this action may count. The openswap hook doesn't write
> anything, but it's still accessing the disk (however, atime is
> disabled in my mount options).
>
> [1]https://www.kernel.org/doc/Documentation/power/swsusp.txt
I just tested with a freshly created filesystem. And indeed just
mounting and unmounting the filesystem writes to the root tree since it
has to synchronize the freespace cache