Bug 982979

Summary: Disable fstrim API/command in RHEL 6
Product: Red Hat Enterprise Linux 6 Reporter: bfan
Component: libguestfsAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: huzhan, leiwang, ptoscano, wshi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.20.11-4.el6 Doc Type: Bug Fix
Doc Text:
Cause: The fstrim feature is marked as available. Consequence: Calling the fstrim API always results in errors. Fix: Mark the fstrim feature as not available, as fstrim is not going to work with the kernel and qemu available in RHEL 6. Result: The fstrim feature is not available, and calling the fstrim API reports that.
Story Points: ---
Clone Of:
: 983331 1088685 1088686 (view as bug list) Environment:
Last Closed: 2014-10-14 06:34:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 983331, 1088685, 1088686    

Description bfan 2013-07-10 09:06:48 UTC
Description of problem:
fstrim and btrfs are not supported in RHEL 6, command 'supported' and 'available' has wrong output for them


Version-Release number of selected component (if applicable):
libguestfs-1.20.9-6.el6.x86_64


How reproducible:
100%


Steps to Reproduce:
><fs> supported
         acl yes
      augeas yes
       btrfs yes
      fstrim yes
       gdisk no
        grub yes
       hivex yes
     inotify yes
         ldm no
   linuxcaps yes
 linuxfsuuid yes
linuxmodules yes
 linuxxattrs yes
        luks yes
        lvm2 yes
       mdadm yes
       mknod yes
      ntfs3g yes
   ntfsprogs yes
    realpath yes
       rsync yes
       scrub yes
     selinux yes
      wipefs yes
         xfs no
          xz yes
    zerofree no

><fs> available fstrim
><fs> available btrfs


Actual result:
Commands does not give error for fstrim and btrfs


Expect result:
Commands should give error for fstrim and btrfs


Additional info:
Same issue in rhel7

Comment 1 Richard W.M. Jones 2013-07-18 13:50:02 UTC
I'm not convinced this is a real bug.

btrfs certainly *exists* on RHEL 6:

$ rpm -qf /lib/modules/2.6.32-358.6.2.el6.x86_64/kernel/fs/btrfs/btrfs.ko
kernel-2.6.32-358.6.2.el6.x86_64
$ rpm -qf /sbin/btrfs
btrfs-progs-0.20-0.2.git91d9eec.el6.x86_64

I'm sure it works as well on RHEL 6 as it does anywhere else,
which is to say, not very well.

fstrim exists on RHEL 6:

$ rpm -qf /sbin/fstrim
util-linux-ng-2.17.2-12.9.el6.x86_64

Maybe there is an issue with the use of the word "supported",
which is an unfortunate choice in the context of RHEL but
can't be changed for backwards compatibility reasons.

We could forcibly disable these in RHEL 6 & 7 on the basis
that they don't really work very well.  Especially on RHEL 6,
btrfs is likely to be broken and fstrim likely does nothing.

Comment 2 Richard W.M. Jones 2013-07-19 10:43:17 UTC
I discussed this with Matt and we agreed it would be
a regression if we were to disable btrfs (which "worked"
previously in RHEL 6).

However fstrim (a new command in libguestfs) can be disabled.

Comment 3 RHEL Program Management 2013-10-14 03:10:50 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 4 Richard W.M. Jones 2013-10-16 12:05:41 UTC
Kick this out to RHEL 6.6.  It's not so important.

Comment 6 Richard W.M. Jones 2014-03-12 14:28:08 UTC
Turns out that libguestfs's implementation of fstrim was
spectacularly broken.  The fix is:

https://github.com/libguestfs/libguestfs/commit/5e105e06be4cc6c88b5d3fc5cf79acb48947e197

However it's still unlikely that fstrim will work on
RHEL 6.  It requires more recent qemu, kernel & virtio-scsi
than we have in RHEL 6.  Thus there is still a case for
removing the API here.

Comment 8 bfan 2014-06-03 06:09:20 UTC
Verified with libguestfs-1.20.11-4.el6.x86_64, fstrim is not supported and available

><fs> supported
         acl yes
      augeas yes
       btrfs yes
      fstrim no
       gdisk no
        grub yes
       hivex yes
     inotify yes
         ldm no
   linuxcaps yes
 linuxfsuuid yes
linuxmodules yes
 linuxxattrs yes
        luks yes
        lvm2 yes
       mdadm yes
       mknod yes
      ntfs3g yes
   ntfsprogs yes
    realpath yes
       rsync yes
       scrub yes
     selinux yes
      wipefs yes
         xfs no
          xz yes
    zerofree no

><fs> available fstrim
libguestfs: error: available: fstrim: group not available

Comment 10 errata-xmlrpc 2014-10-14 06:34:50 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.

http://rhn.redhat.com/errata/RHBA-2014-1458.html