Bug 991204 - gfs2_grow can't find specified device
gfs2_grow can't find specified device
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gfs2-utils (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Andrew Price
Cluster QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-01 16:17 EDT by Nate Straz
Modified: 2014-06-17 20:15 EDT (History)
5 users (show)

See Also:
Fixed In Version: gfs2-utils-3.1.6-10.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 05:51:01 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch fixing this bug (6.45 KB, patch)
2013-08-13 05:33 EDT, Andrew Price
no flags Details | Diff

  None (edit)
Description Nate Straz 2013-08-01 16:17:28 EDT
Description of problem:

While doing multiple grows I got into a state where gfs2_grow failed with:

[root@west-02 ~]# gfs2_grow /dev/growfs/grow2
/dev/growfs/grow2: No such file or directory

[root@west-02 ~]# ls -l /dev/growfs/grow2
lrwxrwxrwx. 1 root root 7 Aug  1 15:38 /dev/growfs/grow2 -> ../dm-4

[root@west-02 ~]# ls -l /dev/growfs/../dm-4
brw-rw----. 1 root disk 253, 4 Aug  1 15:38 /dev/growfs/../dm-4

strace found this interesting item:
open("/proc/mounts", O_RDONLY|O_CLOEXEC) = 4
stat("/dev/growfs/grow2", {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 4), ...}) = 0
fstat(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff77f3c0000
read(4, "rootfs / rootfs rw 0 0\nproc /pro"..., 1024) = 1024
...
read(4, "rowfs-grow1 /mnt/grow1 gfs2 rw,s"..., 1024) = 119
stat("/dev/mapper/growfs-grow1", {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 3), ...}) = 0
stat("/dev/mapper/growfs-grow2", {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 4), ...}) = 0
close(4)                                = 0
munmap(0x7ff77f3c0000, 4096)            = 0
stat("/mnt/grow2", {st_mode=S_IFDIR|0755, st_size=792, ...}) = 0
open("", O_RDWR)                        = -1 ENOENT (No such file or directory)
dup(2)                                  = 4
fcntl(4, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(4, {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 64), ...}) = 0
ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B115200 opost is0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff77f3c0000
lseek(4, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)

Contents of /proc/mounts:

rootfs / rootfs rw 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,nosuid,size=4014840k,nr_inodes=1003710,mode=755 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev 0 0
devpts /dev/pts devpts rw,seclabel,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,seclabel,nosuid,nodev,mode=755 0 0
tmpfs /sys/fs/cgroup tmpfs rw,seclabel,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/0
pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_cls 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
/dev/mapper/rhel_west--02-root / ext4 rw,seclabel,relatime,data=ordered 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=34,pgrp=1,timeout=300,minproto=5,0
configfs /sys/kernel/config configfs rw,relatime 0 0
mqueue /dev/mqueue mqueue rw,seclabel,relatime 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,seclabel,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
/dev/sda1 /boot xfs rw,seclabel,relatime,attr2,inode64,noquota 0 0
/dev/mapper/rhel_west--02-home /home ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/mapper/growfs-grow1 /mnt/grow1 gfs2 rw,seclabel,relatime 0 0
/dev/mapper/growfs-grow2 /mnt/grow2 gfs2 rw,seclabel,relatime 0 0



Version-Release number of selected component (if applicable):
gfs2-utils-3.1.5-2.el7.x86_64

How reproducible:
Unknown

Steps to Reproduce:
1. run growfs test
2.
3.

Actual results:


Expected results:


Additional info:
Comment 2 Andrew Price 2013-08-02 05:46:36 EDT
So it looks like sdp->device_name isn't getting set anywhere so is_gfs2() (called via check_for_gfs2()) fails to open "" and so we get an ENOENT.

I think the right way to fix this is to make gfs2_grow the only place the device is opened and pass the fd to those functions which need access to it. It seems these are also functions we can push out of libgfs2 into gfs2_grow so I'll see to that at the same time.
Comment 3 Andrew Price 2013-08-13 05:33:31 EDT
Created attachment 786092 [details]
Patch fixing this bug

This patch from upstream was pushed into gfs2-utils.git/RHEL7
Comment 6 Nate Straz 2013-10-08 09:16:51 EDT
Still hitting this with the new packages.

dup(2)                                  = 5
fcntl(5, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(5, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff0d3c73000
lseek(5, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(5, "Failed to mount GFS2 meta file s"..., 56Failed to mount GFS2 meta file system: Invalid argument
) = 56
close(5)                                = 0
munmap(0x7ff0d3c73000, 4096)            = 0
exit_group(1)                           = ?
+++ exited with 1 +++
[root@west-03 ~]# rpm -q gfs2-utils
gfs2-utils-3.1.6-5.el7.x86_64
Comment 7 Nate Straz 2013-10-08 09:47:15 EDT
It looks like the grow fails if the device is specified, but succeeds if the mount point is used.

[root@west-05 ~]# gfs2_grow /dev/growfs/grow1
Failed to mount GFS2 meta file system: Invalid argument
[root@west-05 ~]# gfs2_grow /mnt/grow1
FS: Mount point:          /mnt/grow1
FS: Device:               /dev/mapper/growfs-grow1
FS: Size:                 21778431 (0x14c4fff)
FS: Resource group size:  20462 (0x4fee)
DEV: Length:               43557888 (0x298a400)
The file system grew by 85076MB.
gfs2_grow complete.
Comment 8 Andrew Price 2013-10-12 18:18:56 EDT
This patch submitted for upstream will take care of that:

https://www.redhat.com/archives/cluster-devel/2013-October/msg00012.html

I'll add it to the RHEL7 branch once its been reviewed and pushed.
Comment 9 Andrew Price 2013-11-16 15:28:14 EST
The previous patches didn't address some possible race conditions in is_pathname_mounted so I've submitted a new set of patches which will fix this bug and also reduce the possibility of races:

https://www.redhat.com/archives/cluster-devel/2013-November/msg00063.html
https://www.redhat.com/archives/cluster-devel/2013-November/msg00064.html
https://www.redhat.com/archives/cluster-devel/2013-November/msg00065.html
Comment 10 Andrew Price 2013-11-18 06:08:31 EST
Patches pushed to gfs2-utils.git/RHEL7. I'll try to get a build done in time for today's compose.
Comment 12 Nate Straz 2014-02-13 17:05:04 EST
Verified with gfs2-utils-3.1.6-11.el7.x86_64.

growing /dev/growfs/grow2 on buzz-02
FS: Mount point:          /mnt/grow2
FS: Device:               /dev/mapper/growfs-grow2
FS: Size:                 63760813 (0x3cce9ad)
FS: Resource group size:  589756 (0x8ffbc)
DEV: Length:               73019392 (0x45a3000)
The file system grew by 9041MB.
gfs2_grow complete.
Comment 13 Jan Bušta 2014-03-21 06:03:40 EDT
Can you fix it also for F19 and F20?
Comment 14 Andrew Price 2014-03-21 06:30:32 EDT
(In reply to Jan Bušta from comment #13)
> Can you fix it also for F19 and F20?

It will be fixed in Fedora when the next upstream gfs2-utils version is released, but if you require the fix more urgently please file a new bug against gfs2-utils in Fedora and I'll look into adding these patches to the package.
Comment 15 Ludek Smid 2014-06-13 05:51:01 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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