Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
The size of destination file is much more smaller than source after do blockcopy to an CIFS mount point
Version-Release number of selected component (if applicable):
# rpm -q qemu-kvm-rhev libvirt
qemu-kvm-rhev-1.5.3-60.el7ev_0.2.x86_64
libvirt-1.1.1-29.el7.x86_64
How reproducible:
100%
Steps to Reproduce:
1.Prepare samba server and mount it to local
# mount|grep cifs
//10.66.5.xxx/test on /mnt/Samba type cifs (rw,relatime,vers=1.0,cache=strict,username=root,domain=SHYU_TEST_PC,uid=0,noforceuid,gid=0,noforcegid,addr=10.66.5.xxx,file_mode=0777,dir_mode=0777,nounix,serverino,rsize=61440,wsize=65536,actimeo=1)
2. Prepare an transient guest
# virsh list --transient
Id Name State
----------------------------------------------------
46 rhel6 running
# virsh domblklist rhel6
Target Source
------------------------------------------------
vda /var/lib/libvirt/images/rhel6.img
# qemu-img info /var/lib/libvirt/images/rhel6.img
image: /var/lib/libvirt/images/rhel6.img
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 1.2G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
3. Do blockcopy to /mnt/Samba
# virsh blockcopy rhel6 vda /mnt/Samba/copy.img --wait --verbose
Block Copy: [100 %]
Now in mirroring phase
# virsh blockjob rhel6 vda
Block Copy: [100 %]
4. Check disk size of destination file
# qemu-img info /mnt/Samba/copy.img
image: /mnt/Samba/copy.img
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 1.0M
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
5. Finish the blockcopy with --pivot
# virsh blockjob rhel6 vda --pivot
# qemu-img info /mnt/Samba/copy.img
image: /mnt/Samba/copy.img
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 1.0M
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
Actual results:
Expected results:
The "disk size" of destination should be same as source
Additional info:
ENV:
# getsebool virt_use_samba
virt_use_samba --> on
# getenforce
Enforcing
# ll -Z /mnt/
drwxrwxrwx. root root system_u:object_r:cifs_t:s0 Samba
This doesn't have anything to do with qemu or libvirt, this is a known samba bug that has been fixed in later versions.
If you go to the actual samba server, and look at the local filesystem, you will see the file is all there. Samba is just causing the blocks used field returned by fstat to be incorrect.
If you look at other large files in the samba directory with your server, you will likely notice that 'du -sh' and 'ls -lhs' also report incorrect file sizes.
For older versions of samba, the st_blocks field returned by fstat is wrong. I am not sure when this was fixed in samba, but with samba server version 3.6.9 (rhel 6.5), it still reports the incorrect st_blocks field. In newer versions of samba (4.1.1, rhel 7), the st_block field in fstat is reported correctly, from my testing.
Some more reading on the original problem - I am not sure what the follow up to this was, or when this was fixed in samba: https://lkml.org/lkml/2004/9/17/235
Description of problem: The size of destination file is much more smaller than source after do blockcopy to an CIFS mount point Version-Release number of selected component (if applicable): # rpm -q qemu-kvm-rhev libvirt qemu-kvm-rhev-1.5.3-60.el7ev_0.2.x86_64 libvirt-1.1.1-29.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.Prepare samba server and mount it to local # mount|grep cifs //10.66.5.xxx/test on /mnt/Samba type cifs (rw,relatime,vers=1.0,cache=strict,username=root,domain=SHYU_TEST_PC,uid=0,noforceuid,gid=0,noforcegid,addr=10.66.5.xxx,file_mode=0777,dir_mode=0777,nounix,serverino,rsize=61440,wsize=65536,actimeo=1) 2. Prepare an transient guest # virsh list --transient Id Name State ---------------------------------------------------- 46 rhel6 running # virsh domblklist rhel6 Target Source ------------------------------------------------ vda /var/lib/libvirt/images/rhel6.img # qemu-img info /var/lib/libvirt/images/rhel6.img image: /var/lib/libvirt/images/rhel6.img file format: qcow2 virtual size: 5.0G (5368709120 bytes) disk size: 1.2G cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false 3. Do blockcopy to /mnt/Samba # virsh blockcopy rhel6 vda /mnt/Samba/copy.img --wait --verbose Block Copy: [100 %] Now in mirroring phase # virsh blockjob rhel6 vda Block Copy: [100 %] 4. Check disk size of destination file # qemu-img info /mnt/Samba/copy.img image: /mnt/Samba/copy.img file format: qcow2 virtual size: 5.0G (5368709120 bytes) disk size: 1.0M cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false 5. Finish the blockcopy with --pivot # virsh blockjob rhel6 vda --pivot # qemu-img info /mnt/Samba/copy.img image: /mnt/Samba/copy.img file format: qcow2 virtual size: 5.0G (5368709120 bytes) disk size: 1.0M cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false Actual results: Expected results: The "disk size" of destination should be same as source Additional info: ENV: # getsebool virt_use_samba virt_use_samba --> on # getenforce Enforcing # ll -Z /mnt/ drwxrwxrwx. root root system_u:object_r:cifs_t:s0 Samba