Hello Archie.
My test is pretty much the same as yours. The key appears to be
volume size. If I too use a 100MiB volume, fstrim is reliable.
Increasing the volume size brings on the issue. Here are my test
commands, with a 987MiB volume:
# window 1
cd /mnt
mkdir s3backer-test s3backer-mnt fs-mnt
s3backer -f --debug --test --listBlocks --size=987M --blockSize=1m
--blockCacheWriteDelay=5000 --blockCacheSize=300 --filename=s3bbd
/mnt/s3backer-test /mnt/s3backer-mnt
# window 2
mkfs.xfs /mnt/s3backer-mnt/s3bbd
mount -o loop /mnt/s3backer-mnt/s3bbd /mnt/fs-mnt
df -h /mnt/fs-mnt
fstrim -v /mnt/fs-mnt
sleep 5
umount /mnt/fs-mnt
You should see an error like this from the fstrim:
fstrim: /mnt/fs-mnt: FITRIM ioctl failed: Input/output error
There will also be a few 'wrong MD5 checksum' errors in s3backer's
debug output, and in /var/log/syslog:
Jul 24 19:27:50 vagrant kernel: [170899.075702] XFS (loop0): Mounting
V5 Filesystem
Jul 24 19:27:50 vagrant kernel: [170899.094045] XFS (loop0): Ending clean mount
Jul 24 19:27:52 vagrant kernel: [170900.586482] print_req_error: I/O
error, dev loop0, sector 505416
Jul 24 19:27:53 vagrant kernel: [170901.908587] print_req_error: I/O
error, dev loop0, sector 1017600
Jul 24 19:27:53 vagrant kernel: [170902.020280] print_req_error: I/O
error, dev loop0, sector 1516104
Jul 24 19:27:58 vagrant kernel: [170907.033558] XFS (loop0):
Unmounting Filesystem
Jul 24 19:27:58 vagrant kernel: [170907.135379] loop: Write error at
byte offset 517493760, length 1024.
Jul 24 19:27:58 vagrant kernel: [170907.136451] print_req_error: I/O
error, dev loop0, sector 1010730
Jul 24 19:27:58 vagrant kernel: [170907.137463] print_req_error: I/O
error, dev loop0, sector 1010730
Jul 24 19:27:58 vagrant kernel: [170907.138615] XFS (loop0): metadata
I/O error in "xlog_iodone" at daddr 0xf6c2a len 64 error 5
Jul 24 19:27:58 vagrant kernel: [170907.139654] XFS (loop0):
xfs_do_force_shutdown(0x2) called from line 1250 of file
/build/linux-hwe-mCxn_j/linux-hwe-4.18.0/fs/xfs/xfs_log.c. Return
address = 00000000f04aabce
Jul 24 19:27:58 vagrant kernel: [170907.139700] XFS (loop0): Log I/O
Error Detected. Shutting down filesystem
Jul 24 19:27:58 vagrant kernel: [170907.140777] XFS (loop0): Please
umount the filesystem and rectify the problem(s)
Jul 24 19:27:58 vagrant kernel: [170907.142738] XFS (loop0): Unable to
update superblock counters. Freespace may not be correct on next
mount.
My test system is Ubuntu 18.04 with the HWE kernel (4.18.0-25), with
whatever packages are recommended on the s3backer wiki for compiling
the code, from the standard repos.
Many thanks, Andy