Bug 1399830

Summary: GFS2: fallocate error message during gfs2_grow
Product: Red Hat Enterprise Linux 7 Reporter: Nate Straz <nstraz>
Component: kernelAssignee: Andrew Price <anprice>
kernel sub component: GFS/GFS2 QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: cluster-maint, gfs2-maint
Version: 7.3   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kernel-3.10.0-657.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-02 04:53:19 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:

Description Nate Straz 2016-11-29 20:41:46 UTC
Description of problem:

When I grow a GFS2 file system the successful output includes an error about fallocate not being supported.


[root@host-135 ~]# df -h /mnt/growfs0/
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/growfs-growfs0  300G  259M  300G   1% /mnt/growfs0
[root@host-135 ~]# lvs growfs
  LV      VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  growfs0 growfs -wi-ao---- 300.00g
[root@host-135 ~]# lvextend -L 400G growfs/growfs0
  Size of logical volume growfs/growfs0 changed from 300.00 GiB (76800 extents) to 400.00 GiB (102400 extents).
  Logical volume growfs/growfs0 successfully resized.
[root@host-135 ~]# lvs growfs
  LV      VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  growfs0 growfs -wi-ao---- 400.00g
[root@host-135 ~]# gfs2_grow /mnt/growfs0/
FS: Mount point:             /mnt/growfs0
FS: Device:                  /dev/mapper/growfs-growfs0
FS: Size:                    78643199 (0x4afffff)
DEV: Length:                 104857600 (0x6400000)
The file system will grow by 102400MB.
fallocate: Operation not supported                      <--- HERE
gfs2_grow complete.
[root@host-135 ~]# echo $?
0
[root@host-135 ~]# df -h /mnt/growfs0/
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/growfs-growfs0  400G  259M  400G   1% /mnt/growfs0

I ran the command with strace and found that gfs2_grow is trying to fallocate on the rindex on the gfs2metafs.

18856 open("/tmp/.gfs2meta.xvHEtj/rindex", O_RDWR|O_CLOEXEC) = 6
...
18856 fallocate(6, 01, 15648, 96)       = -1 EOPNOTSUPP (Operation not supported)


The file system does grow and appears to be completely usable.

Version-Release number of selected component (if applicable):
gfs2-utils-3.1.9-3.el7.x86_64
kernel-3.10.0-514.el7.x86_64

How reproducible:
Easily

Steps to Reproduce:
See example above.

Actual results:
Odd error message is printed

Expected results:
No odd error message during a successful command.

Additional info:

Comment 2 Andrew Price 2016-11-30 14:57:25 UTC
gfs2_grow uses

    if (fallocate(rindex_fd, FALLOC_FL_KEEP_SIZE, (rindex_size + writelen), entrysize) != 0)
           perror("fallocate");

to allocate enough space to write an rindex entry if the fs is full when the next grow happens. So, while the grow will succeed, the danger of the fallocate() failing is that a second gfs2_grow could fail if the fs is full.

After a recent change to fix bug 1221331, gfs2's fallocate implementation does:

    if ((mode & ~FALLOC_FL_KEEP_SIZE) || gfs2_is_jdata(ip))
           return -EOPNOTSUPP;

and since mkfs.gfs2 creates the rindex inode with GFS2_DIF_JDATA set, the gfs2_is_jdata(ip) returns true and we see the bug.

So I'm not sure that we can fix this in gfs2_grow. We may need to allow gfs2's fallocate to proceed for the rindex especially, or for all GFS2_DIF_SYSTEM inodes.

Comment 3 Andrew Price 2017-04-04 16:12:48 UTC
I have submitted an upstream patch for this to cluster-devel.

Comment 4 Andrew Price 2017-04-06 00:10:12 UTC
The patch is now upstream and I have sent a RHEL7 version to rhkernel-list.

Comment 5 Rafael Aquini 2017-04-24 16:15:38 UTC
Patch(es) committed on kernel repository and an interim kernel build is undergoing testing

Comment 7 Rafael Aquini 2017-04-25 12:23:05 UTC
Patch(es) available on kernel-3.10.0-657.el7

Comment 9 Nate Straz 2017-06-15 18:40:46 UTC
Verified on kernel-3.10.0-679.el7.x86_64

[root@dash-01 ~]# uname -r
3.10.0-679.el7.x86_64
[root@dash-01 ~]# df -Th /mnt/gfs2
Filesystem            Type  Size  Used Avail Use% Mounted on
/dev/mapper/fsck-gfs2 gfs2  1.0T   34M  1.0T   1% /mnt/gfs2
[root@dash-01 ~]# lvextend -L +1T /dev/fsck/gfs2
  Size of logical volume fsck/gfs2 changed from 1.00 TiB (262144 extents) to 2.00 TiB (524288 extents).
  Logical volume fsck/gfs2 successfully resized.
[root@dash-01 ~]# gfs2_grow /mnt/gfs2
FS: Mount point:             /mnt/gfs2
FS: Device:                  /dev/mapper/fsck-gfs2
FS: Size:                    268435454 (0xffffffe)
DEV: Length:                 536870912 (0x20000000)
The file system will grow by 1048576MB.
gfs2_grow complete.
[root@dash-01 ~]# df -Th /mnt/gfs2
Filesystem            Type  Size  Used Avail Use% Mounted on
/dev/mapper/fsck-gfs2 gfs2  2.0T   34M  2.0T   1% /mnt/gfs2

Comment 11 errata-xmlrpc 2017-08-02 04:53:19 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.

https://access.redhat.com/errata/RHSA-2017:1842