Bug 480338

Summary: ext2online does not resize multipath devices because it looks for the wrong device name in /etc/mtab
Product: Red Hat Enterprise Linux 4 Reporter: Jeff Moyer <jmoyer>
Component: e2fsprogsAssignee: Eric Sandeen <esandeen>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: low    
Version: 4.8CC: sct
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
* ext2online canonicalized path names passed in from the command line before searching for devices in /etc/mtab. In the case of multipath devices, this would fail because the canonical path is not referenced in /etc/mtab, and attempts to pass in the canonical path from the command line would fail for the same reason. Ext2online could not therefore resize multipath devices. Ext2online now searches /etc/mtab for the path name passed in from the command line and will only search for the canonical name if the first search fails. Since ext2online can now find multipath devices, it can therefore resize them.
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-18 20:25:47 UTC Type: ---
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: 454872    
Attachments:
Description Flags
Use the device name passed in on the command line when looking up the file system in the mount table. none

Description Jeff Moyer 2009-01-16 15:02:41 UTC
Description of problem:

Please see bug 454872, comment #18.  The configuration there had a multipath device, /dev/mpath/mpath9, mounted on /mnt/equallogic.  /dev/mpath/mpath9 is a symbolic link to /dev/dm-12.  An strace of the ext2online program reveals the following:

readlink("/dev", 0x7fbfffe700, 4096)    = -1 EINVAL (Invalid argument)
readlink("/dev/mpath", 0x7fbfffe700, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/mpath/mpath9", "../dm-12", 4096) = 8
readlink("/dev/dm-12", 0x7fbfffe700, 4096) = -1 EINVAL (Invalid argument)
open("/etc/mtab", O_RDONLY)             = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=448, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a95558000
read(3, "/dev/mapper/rhel4volgrp-rhel4x86"..., 4096) = 448
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x2a95558000, 4096)              = 0

The error message that is printed is the following:

  ext2online: can't find /dev/dm-12, is it mounted?

The entry in /etc/mtab is as follows:

  /dev/mpath/mpath9 /mnt/equallogic ext3 rw 0 0

Using the --force option has no effect.  Because the mtab entry references mpath9, specifying dm-12 also does not work.


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

e2fsprogs-1.35-12.17.el4

How reproducible:
100%

Steps to Reproduce:
1. Setup any multipath device.  You don't even need to have multiple paths to the device.  In the case above, I used iSCSI, but you should even be able to use a local disk.  All that is required (if you're not familiar with setting up multipathing) is to modify /etc/multipath.conf to remove the blacklist entry (first entry) and start the multipathd service.

2. Create and mount a file system on a multipath device.

3. Try to resize the file system (even if the disk size didn't change).

Comment 1 Jeff Moyer 2009-01-16 16:35:02 UTC
Created attachment 329223 [details]
Use the device name passed in on the command line when looking up the file system in the mount table.

This patch resolves the problem in my environment.  I tested it on a multipath device, an LVM device, and a regular scsi device and they all worked fine.

Comment 3 Eric Sandeen 2009-01-21 23:11:42 UTC
I'm wondering if this was really mounted when it was tested, though the comment in the other bug seems to indicate that it does (I don't see the actual failure output, though).  In my testing (w/ a printf to show what the canonicalization does):

Mount the multipath device:

[root@sig11 ext2resize-1.1.17]# mount /dev/mpath/mpath9 /mnt/test
[root@sig11 ext2resize-1.1.17]# mount | grep /mnt/test
/dev/dm-11 on /mnt/test type ext3 (rw)
[root@sig11 ext2resize-1.1.17]# grep /mnt/test /etc/mtab
/dev/dm-11 /mnt/test ext3 rw 0 0
[root@sig11 ext2resize-1.1.17]# grep /mnt/test /proc/mounts
/dev/mpath/mpath9 /mnt/test ext3 rw 0 0

Resize it by pointing at the mpath device:

[root@sig11 ext2resize-1.1.17]# src/ext2online /dev/mpath/mpath9 
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
canonicalized /dev/mpath/mpath9 to /dev/dm-11
ext2online: new size is same as current (1052160)

(worked)

Resize by pointing at the dm device:

[root@sig11 ext2resize-1.1.17]# src/ext2online /dev/dm-11
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
canonicalized /dev/dm-11 to /dev/dm-11
ext2online: new size is same as current (1052160)

(worked)

Resize it by pointing at the mount point:

[root@sig11 ext2resize-1.1.17]# src/ext2online /mnt/test
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
canonicalized /mnt/test to /mnt/test
ext2online: new size is same as current (1052160)

(worked)

Unmount & try again:

[root@sig11 ext2resize-1.1.17]# umount /mnt/test
[root@sig11 ext2resize-1.1.17]# src/ext2online /dev/mpath/mpath9 
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
canonicalized /dev/mpath/mpath9 to /dev/dm-11
ext2online: can't find /dev/dm-11, is it mounted?

Jeff, any idea?

Comment 4 Jeff Moyer 2009-01-22 16:38:49 UTC
Hi, Eric,

Yes, it was really mounted.  What you are seeing is that /etc/mtab actually points at /dev/dm-3 instead of /dev/mpath/mpath9.  Had it pointed to the latter, you would see the problem I ran into.  For whatever reason, I cannot reproduce mount putting an entry for the mpath device into mtab, now.

Comment 5 Eric Sandeen 2009-01-22 20:47:27 UTC
Committed in e2fsprogs-1.35-12.23.el4

Comment 7 Ruediger Landmann 2009-01-28 05:03:13 UTC
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
* ext2online canonicalized path names passed in from the command line before searching for devices in /etc/mtab. In the case of multipath devices, this would fail because the canonical path is not referenced in /etc/mtab, and attempts to pass in the canonical path from the command line would fail for the same reason. Ext2online could not therefore resize multipath devices. Ext2online now searches /etc/mtab for the path name passed in from the command line and will only search for the canonical name if the first search fails. Since ext2online can now find multipath devices, it can therefore resize them.

Comment 10 errata-xmlrpc 2009-05-18 20:25:47 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0996.html