Created attachment 1755998 [details] virt-sparsify-debug.log Description of problem: Attempting to in-place sparsify an NTFS image fails. Version-Release number of selected component (if applicable): libguestfs-1:1.43.2-2.fc33.x86_64 libguestfs-tools-1:1.43.2-2.fc33.noarch How reproducible: Always Steps to Reproduce: 1. Create NTFS qcow2 image ``` guestfish <<EOF disk-create test.qcow2 qcow2 1G add test.qcow2 run part-disk /dev/sda gpt mkfs ntfs /dev/sda1 EOF ``` 2. virt-sparsify --in-place -x -v test.qcow2 (this also occurs on a qcow2 image from a clean Windows install) Actual results: virt-sparsify: error: libguestfs error: fstrim: fstrim: /sysroot/: FITRIM ioctl failed: Device or resource busy Expected results: Sparsify in-place operation completed with no errors Additional info: - Omitting `--in-place` and specifying a destination image works. - Tested with vfat and ext4 instead of ntfs; both were successful with in-place. - Debug log is attached - libguestfs-test-tool reports OK
I can reproduce the bug. It fails in the same way in virt-rescue too: $ virt-rescue --ro -a test.qcow2 ><rescue> mount -o discard /dev/sda1 /sysroot/ ><rescue> fstrim -v /sysroot/ fstrim: /sysroot/: FITRIM ioctl failed: Device or resource busy
With ntfs-3g option -o debug enabled: unique: 4, opcode: GETATTR (3), nodeid: 1, insize: 56 unique: 4, error: 0 (Success), outsize: 120 unique: 6, opcode: GETATTR (3), nodeid: 1, insize: 56 unique: 6, error: 0 (Success), outsize: 120 unique: 8, opcode: GETATTR (3), nodeid: 1, insize: 56 unique: 8, error: 0 (Success), outsize: 120 unique: 10, opcode: ACCESS (34), nodeid: 1, insize: 48 ACCESS / 00 unique: 10, error: 0 (Success), outsize: 16 unique: 12, opcode: OPENDIR (27), nodeid: 1, insize: 48 unique: 12, error: 0 (Success), outsize: 32 unique: 14, opcode: IOCTL (39), nodeid: 1, insize: 96 unique: 14, error: 0 (Success), outsize: 56 fstrim: /sysroot/: FITRIM ioctl failed: Device or resource busy unique: 16, opcode: RELEASEDIR (29), nodeid: 1, insize: 64 unique: 16, error: 0 (Success), outsize: 16 Which makes me think the error must actually be coming from FUSE or the host kernel. (Note that the ioctl call succeeds according to ntfs-3g.)
Similar recent bugs: https://bugzilla.redhat.com/show_bug.cgi?id=1922857 https://bbs.archlinux.org/viewtopic.php?id=262243 https://bugzilla.kernel.org/show_bug.cgi?id=211167
I have bisected this in the kernel. Please see my comments on the upstream bug: https://bugzilla.kernel.org/show_bug.cgi?id=211167
*** Bug 1922857 has been marked as a duplicate of this bug. ***
Upstream Kernel bug linked above indicates this is resolved, and my test case succeeds now in Fedora using Kernel 5.11.16-300.fc34.x86_64.
This message is a reminder that Fedora 33 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '33'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 33 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
This was fixed a few months ago and the fix is definitely in Rawhide and probably earlier releases too (not sure about F33).