Bug 1038977 - libguestfs does not works together with xfs + 4k sector size
Summary: libguestfs does not works together with xfs + 4k sector size
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.5
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Pino Toscano
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2013-12-06 09:44 UTC by Attila Fazekas
Modified: 2015-07-22 05:55 UTC (History)
9 users (show)

Fixed In Version: libguestfs-1.20.11-13.el6
Doc Type: Bug Fix
Doc Text:
The libguestfs utilities were not able to use disk images on XFS file systems with 4-kilobyte sector size. This update introduces the "cachemode" parameter for the add_drive API, which controls drive caching and has a default value which allows disk images stored on the described file systems to be usable.
Clone Of:
Last Closed: 2015-07-22 05:55:10 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1444 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2015-07-20 18:44:02 UTC
Red Hat Knowledge Base (Solution) 1492313 None None None Never

Description Attila Fazekas 2013-12-06 09:44:13 UTC
Description of problem:
libguestfs using cache type equivalent to quemu's cache=none option.
Basically it means disk images will be opened with O_DIRECT option.

xfs requires all I/O operation count/size needs to be integer multiple of the sector size.

If my sector size is 4k, the 512 byte read is invalid:

strace -Ff -e pread,read,open,write,read guestfish -a Fedora-x86_64-19-20130627-sda.qcow2 run
[pid 18605] open("Fedora-x86_64-19-20130627-sda.qcow2", O_RDWR|O_DIRECT|O_CLOEXEC) = 6
[pid 18616] pread(6, 0x7fce10000a00, 512, 0) = -1 EINVAL (Invalid argument)

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. mkfs.xfs -f -s size=4096  /dev/vdb
2. mkdir /mnt/4k
3. mount /dev/vdb /mnt/4k
4. cd /mnt/4k
5. wget http://download.fedoraproject.org/pub/fedora/linux/releases/19/Images/x86_64/Fedora-x86_64-19-20130627-sda.qcow2
6. guestfish -a Fedora-x86_64-19-20130627-sda.qcow2 run

Actual results:
[root@xfs 4k]# guestfish -a Fedora-x86_64-19-20130627-sda.qcow2 run
libguestfs: error: /usr/libexec/qemu-kvm exited with error status 1.
To see full error messages you may need to enable debugging.
See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
libguestfs: error: guestfs_launch failed.
See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
and/or run 'libguestfs-test-tool'.

Expected results:
[root@xfs 512b]# guestfish -a Fedora-x86_64-19-20130627-sda.qcow2 run
[root@xfs 512b]# 

Do not use O_DIRECT.

Additional info:

The O_DIRECT is not used when the file-system refusing to open the image with O_DIRECT (like on tmpfs), but in the above situation it is failing on the read/write alignment and size requirements.

Newer version of the libguestfs are allowing to use the "writeback" mode.

(Disk with 4k physical sector size are very common in the market, probably in 2014 several now disk will also have 4k logical sector size.)

Comment 1 Richard W.M. Jones 2013-12-06 09:55:33 UTC
Upstream fix is:

+ a few patches that follow that one.

(Is there a reason why this bug needs to be private?)

Comment 2 Richard W.M. Jones 2014-03-24 08:13:02 UTC
Pino: Fixing this involves backporting all the cachemode
stuff to RHEL 6.  Up to you if you can do this or think it
is too risky for an old stable RHEL release.

Comment 3 Richard W.M. Jones 2014-06-20 13:21:20 UTC
We decided not to fix this in RHEL 6.  However it has been
fixed in RHEL 7.0 and above.

Comment 4 Richard W.M. Jones 2014-08-04 09:27:22 UTC
I'm reopening this on the basis that two people have reported this
bug in RHOS when using XFS as a backing store for disk images.

Comment 8 Hu Zhang 2015-03-10 08:37:05 UTC
Verified with the package version:

Verify steps:
1. mkfs.xfs -f -s size=4096  test.raw
2. mkdir /mnt/4k
3. mount test.raw /mnt/4k -o loop
4. cd /mnt/4k
5. wget http://download.fedoraproject.org/pub/fedora/linux/releases/19/Images/x86_64/Fedora-x86_64-19-20130627-sda.qcow2
6. # guestfish -a Fedora-x86_64-19-20130627-sda.qcow2
   ><fs> run
   ><fs> list-filesystems 
   /dev/sda1: ext4

So verified.

Comment 13 errata-xmlrpc 2015-07-22 05:55:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.