RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1458201 - resize2fs does not work with renamed device
Summary: resize2fs does not work with renamed device
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: e2fsprogs
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Lukáš Czerner
QA Contact: Filesystem QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-02 09:52 UTC by Zdenek Kabelac
Modified: 2017-06-07 10:41 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-05 14:46:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1253833 0 unspecified CLOSED renaming logical volumes to previously existing volume names causes confusion when lvresize calls fsadm 2021-09-03 12:56:05 UTC

Internal Links: 1253833

Description Zdenek Kabelac 2017-06-02 09:52:54 UTC
Description of problem:

When a mounted device is renamed (thus mounted device path in /proc/mountinfo differs from actual device name), resize2fs tools does not work and reports error:

resize2fs 1.43.4 (31-Jan-2017)
resize2fs: Device or resource busy while trying to open /dev/vg/LVREN
Couldn't find valid filesystem superblock.


This makes problematic usage of i.e. lvrename and resizing mounted renamed volume - currently resolved by disallowing it - see bug 1253833.


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

How reproducible:


Steps to Reproduce:
1. create LV & mkfs 
2. mount & rename LV after mount
3. rename & resize LV  
4  try to 'resize2fs' to use bigger size

Actual results:


Expected results:


Additional info:

Comment 2 Eric Sandeen 2017-06-02 13:49:52 UTC
What is the usecase for this?  When (or why) would we want to rename a mounted filesystem's device, then grow it?

Comment 3 Zdenek Kabelac 2017-06-02 18:04:55 UTC
User's workflow - 

Create an LV.
Mount it and use it.
Now - for whatever reason 'rename' of LV is needed (i.e. to reuse the name for something else).

And now you need to resize such mounted LV.


I'm not saying this is some major use-case - but it's quite limiting to think about resizing & renaming which is not working ok.

Clearly there is also known 'workaround' which does require either umount, or postponing rename to next mount time - but the limit is a 

A side note - resize_reiserfs is the ONLY tool I know so far which seems to handle this particular case nicely.

Comment 4 Eric Sandeen 2017-06-02 19:50:53 UTC
As I said in the xfs bug, I think that if you want this to work you need a kenrel interface to change what is in /proc/mounts (and, possibly an interface to change /etc/mtab)

getmntent(3) is /the/ way to iterate mounted filesystems and gather status.  If you rip a devicename out from under it, there should be no real surprise that getmntent() iterators no longer find the filesystem...

Comment 5 Eric Sandeen 2017-06-02 19:51:45 UTC
Or a simpler solution would be to disallow renames of mounted devices...

Comment 6 Eric Sandeen 2017-06-02 20:16:42 UTC
The more I think about this ... we're not going to try to work around this.  getmntent() is a widely used system interface to identify mounted devices, and it relies on what is in /proc/mounts and/or /etc/mtab.  If you rip devicenames out from under it, things fail, and I don't think you can expect every getmntent() user to work around that.

Comment 7 Zdenek Kabelac 2017-06-02 23:16:21 UTC
Please think about this issue a bit longer.

As already mentioned -  resize_reiserfs DOES handle this case nicely - so it proves the point it CAN easily work.

So surely it's not true you need to change anything in kernel or any API in getmntent.

I've already updated  'fsadm' script to disallow  resize with broken  resize2fs & xfs_growfs - and I'm able to perfectly recognize mounted device on any mountpoint in plain bash script with just  'stat' command - so all needed info is easily accessible.

Effectively tools like 'resize2fs'  do resize a device - it does not need to be mounted to be resized - so what does matter here is  MAJOR:MINOR -  anything like device path is really irrelevant - and even changes over the time of kernel evolution - i.e. dm device name were shown with numbers of ways in past already.

So if you think about this more - tools should be improved to handle the only stable and unique interface  kernel provides -  MAJOR:MINOR - using path is never going to 'good enough'.

Comment 8 Eric Sandeen 2017-06-05 14:46:37 UTC
No.  You can't rip mounted device names out of the system, leaving /proc/partitions invalid and inconsistent, and expect userspace to not break all over.

If you want to be able to do that, you will need to add an interface to the kernel to keep the kernel's view of mounted devices consistent when you change mounted device names, and update /etc/mtab as well, if it's not a symlink.

We're not going to chase through every user of getmntent() that breaks and rewrite them so that they work when LVM does unfriendly things.  Just because we can hack around the damage in some cases does not mean that it is the right approach.

> Effectively tools like 'resize2fs' do resize a device - it does not need to be mounted to be resized

Sure, and if it's not mounted, it will work just fine.

My complaint is not about renaming devices, it is about renaming /mounted/ devices.

We have too much critical work on our plate to spend time chasing weird, corner-case, broken behavior like this.

Comment 9 Eric Sandeen 2017-06-06 18:50:52 UTC
Sorry, for posterity: I referenced /proc/partitions when I meant /proc/mounts.

Comment 10 Zdenek Kabelac 2017-06-07 10:41:58 UTC
Well just minor notice -  /proc/mounts is already replaced with far better /proc/self/mountinfo   which does provide major:minor.

So as said - renamed device can be easily identified with major:minor.

You might also be unware of problem with 'duplicate' devices - where  udev is simply replacing  device path with whatever 'random' devices is placed in.

So anything that identifies devices by /dev path is implicitly  broken by current udev design -  the only real valid identifier is simply major:minor.


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