Bug 1564983

Summary: The mount-vfs failed to mount the logical volume
Product: Red Hat Enterprise Linux 7 Reporter: YongkuiGuo <yoguo>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.6CC: ptoscano
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libguestfs-1.38.1-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 07:45:35 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: 1551055    
Bug Blocks:    

Description YongkuiGuo 2018-04-09 06:09:18 UTC
Description of problem:

The mount-vfs command failed to mount the logical volume to '/'. However, the mount command is OK.


Version-Release number of selected component (if applicable):
libguestfs-1.38.0-1.el7.x86_64
qemu-kvm-1.5.3-156.el7.x86_64
kernel-3.10.0-862.el7.x86_64
libvirt-3.9.0-14.el7.x86_64

How reproducible:
100%


Steps:

1. On rhel7.5 host
#qemu-img create -f raw fs_mount.ext2.raw 10G

2.#guestfish -a fs_mount.ext2.raw -v -x
><fs> run
><fs> pvcreate /dev/sda
><fs> vgcreate vol_test /dev/sda
><fs> lvcreate vol_file vol_test 10000
><fs> mkfs ext2 /dev/vol_test/vol_file
><fs> list-filesystems
/dev/vol_test/vol_file: ext2
><fs> mount-vfs "" ext2 /dev/vol_test/vol_file /
-------------------------------------------------
libguestfs: trace: mount_vfs "" "ext2" "/dev/vol_test/vol_file" "/"
libguestfs: trace: vfs_type "/dev/vol_test/vol_file"

guestfsd: <= vfs_type (0xc6) request length 68 bytes
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: udevadm --debug settle -E /dev/vol_test/vol_file
calling: settle
command: blkid '-c' '/dev/null' '-o' 'value' '-s' 'TYPE' '/dev/vol_test/vol_file'
command: blkid returned 0
command: blkid: stdout:
ext2
guestfsd: => vfs_type (0xc6) took 0.00 secs
libguestfs: trace: vfs_type = "ext2"
guestfsd: <= mount_vfs (0x4b) request length 88 bytes
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: udevadm --debug settle -E /dev/vol_test/vol_file
calling: settle
[   11.893586] traps: guestfsd[190] general protection ip:5583dc66da83 sp:7ffcc869b910 error:0 in guestfsd[5583dc585000+1c2000]
/init: line 244:   190 Segmentation fault      $cmd
+ sync
+ test '' = 1
+ reboot -f
Rebooting.
[   11.900859] Unregister pv shared memory for cpu 0
[   11.901502] sd 2:0:1:0: [sdb] Synchronizing SCSI cache
[   11.902234] sd 2:0:0:0: [sda] Synchronizing SCSI cache
[   11.903551] Restarting system.
[   11.903960] reboot: machine restart
libguestfs: error: appliance closed the connection unexpectedly, see earlier error messages
libguestfs: child_cleanup: 0x5632104f6cd0: child process died
libguestfs: calling virDomainDestroy flags=0
libguestfs: trace: mount_vfs = -1 (error)
-------------------------------------------------



Actual results:
The mount-vfs command failed with segmentation fault.


Expected results:
The mount-vfs command can mount the logical volume successfully.


Additional info:
The same error occurs on other filesystems(ext3,ext4,xfs).

Comment 2 Richard W.M. Jones 2018-04-09 07:38:25 UTC
> [   11.893586] traps: guestfsd[190] general protection ip:5583dc66da83 sp:7ffcc869b910 error:0 in guestfsd[5583dc585000+1c2000]
/init: line 244:   190 Segmentation fault      $cmd

Ouch.

A one line reproducer (which works upstream too) is:

$ guestfish -v -x -N lvfs mount-vfs "" ext2 /dev/VG/LV /

Comment 3 Richard W.M. Jones 2018-04-09 07:55:33 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2018-April/msg00059.html

Comment 5 Pino Toscano 2018-05-02 11:23:02 UTC
Fix backported in 1.38.1.

Comment 7 YongkuiGuo 2018-05-04 03:48:53 UTC
Verified with packages:
libguestfs-1.38.1-1.el7.x86_64


Steps:

1. On rhel7.5 host
#guestfish -v -x -N lvfs mount-vfs "" ext2 /dev/VG/LV /
---------------------------------------------------------
...
command: mount '-t' 'ext2' '/dev/VG/LV' '/sysroot//'
[    2.570310] EXT4-fs (dm-0): mounting ext2 file system using the ext4 subsystem
[    2.573742] EXT4-fs (dm-0): mounted filesystem without journal. Opts: (null)
guestfsd: => mount_vfs (0x4b) took 0.01 secs
libguestfs: trace: mount_vfs = 0
...
---------------------------------------------------------
No error pops up. So verified this bug.

Comment 11 errata-xmlrpc 2018-10-30 07:45:35 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/RHEA-2018:3021