Bug 1250717 - ext4 sets NEEDS_RECOVERY when unfreezing a journal-less filesystem (ext2); blkid gets confused
ext4 sets NEEDS_RECOVERY when unfreezing a journal-less filesystem (ext2); bl...
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
22
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Eric Sandeen
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-05 16:01 EDT by Stu Mark
Modified: 2016-06-28 12:03 EDT (History)
12 users (show)

See Also:
Fixed In Version: 4.1.6-201.fc22
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-02-15 10:36:08 EST
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)

  None (edit)
Description Stu Mark 2015-08-05 16:01:35 EDT
Description of problem:

This problem exists in fedora 20, 21 and 22 but not CentOS 7

If you have an ext2 volume and it uses the ext4 driver (by having lvm or some ext4 volumes as well), if you fsfreeze then unfreeze the ext2 partition, the UUID dissappears from blkid for that ext2 volume.

blkid -p on the specific volume yields nothing.

To fix it, before you reboot, if you umount and mount the partition again, it will fix the UUID and the machine will boot ok.

We also found that if you only have ext2 volumes you will get a 'not supported' error if you try to fsfreeze the ext2 volume, so we're thinking it's the ext4 driver that, when used to fsfreeze ext2, causes the problem.

When you run fsfreeze the UUID is still there, it's when you fsfreeze --unfreeze that the problem happens.
After you unfreeze, blkid will not show the UUID, but lsblk -f will.
If you then refreeze the volume, the UUID will reappear in blkid while it's frozen, but disappear again when you unfreeze.

Version-Release number of selected component (if applicable):
We saw this in util-linux 2.24 and 2.25

How reproducible:
Consistently.

Steps to Reproduce:
1. install fedora core 20, 21 or 22
2. create an lvm or some ext4 volumes on the same disk
3. create a /boot volume with ext2
4. blkid (note the UUID)
5. fsfreeze --freeze /boot
6. fsfreeze --unfreeze /boot
7. blkid (note the lack of UUID)

Actual results:
No UUID for the ext2 volume

Expected results:
UUID should still exist for ext2 volume.

Additional info:
If you make ext2 volumes on one disk, and ext4 volumes on another disk, the problem will not happen. It seems to happen if there are ext2 and ext4 volumes mixed on the same block device, definitely happens if there's an lvm on the same disk.

This was all tested on virtual machines (virtualbox) with fedora 20, 21 and 22 for different tests. The behavior was the same.
Comment 1 Eric Sandeen 2015-08-05 16:17:06 EDT
Ok, that's pretty weird.  (I can see it here, too).  Not sure what's up yet.
Comment 2 Eric Sandeen 2015-08-05 16:34:10 EDT
the needs_recovery feature is set when the fs is unfrozen (which is an odd thing to set on a filesystem w/o a journal)

It's not set on the original mount, but is set after the filesystem is frozen & unfrozen.  This probably confuses blkid's probing.

Yup, derp:

static int ext4_unfreeze(struct super_block *sb)
{
        if (sb->s_flags & MS_RDONLY)
                return 0;

        /* Reset the needs_recovery flag before the fs is unlocked. */
        EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);

it's setting it unconditionally.

This shouldn't be set if it doesn't have a journal, I'll see how that regressed, and send a patch upstream.

It looks like:

commit 9ca92389c5312a51e819c15c762f0abdc7f3129b
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Fri May 1 12:52:25 2009 -0400

    ext4: Use separate super_operations structure for no_journal filesystems
    
    By using a separate super_operations structure for filesystems that
    have and don't have journals, we can simply ext4_write_super() ---
    which is only needed when no journal is present --- and ext4_freeze(),
    ext4_unfreeze(), and ext4_sync_fs(), which are only needed when the
    journal is present.
    
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>


followed by:

commit f6e63f90809946d410c42045577cb159fedabf8c
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Thu Sep 18 17:12:30 2014 -0400

    ext4: fold ext4_nojournal_sops into ext4_sops
    
    There's no longer any need to have a separate set of super_operations
    for nojournal mode.
    
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>

messed this up.

-Eric
Comment 3 Eric Sandeen 2015-08-05 18:14:17 EDT
I've sent a patch upstream for this.
Comment 4 Stu Mark 2015-08-06 09:09:45 EDT
Thanks, you rock, this was driving us nuts. Much appreciated.
Comment 5 Josh Boyer 2015-08-06 11:03:09 EDT
(In reply to Eric Sandeen from comment #3)
> I've sent a patch upstream for this.

Got a URL to the thread?
Comment 7 Josh Boyer 2015-08-06 13:44:22 EDT
(In reply to Eric Sandeen from comment #6)
> http://www.spinics.net/lists/linux-ext4/msg48688.html

Should probably CC stable?  I'd reply on-list, but I'm not subscribed to the fs-specific lists.
Comment 8 Eric Sandeen 2015-08-06 14:10:28 EDT
I suppose; it's kind of a corner case, but probably worth fixing up.
Comment 9 Neal Gompa 2015-08-11 07:40:07 EDT
Has the fix been pushed to stable kernels yet?
Comment 10 Eric Sandeen 2015-08-11 12:22:41 EDT
It's had no response on the ext4 list yet.  :(
Comment 11 Josh Boyer 2015-08-13 08:16:33 EDT
(In reply to Eric Sandeen from comment #10)
> It's had no response on the ext4 list yet.  :(

Right.  Not that I don't trust Eric entirely, but I at least wanted to see if upstream had a comment before backporting.
Comment 12 Neal Gompa 2015-08-13 10:45:23 EDT
Would it be possible to introduce this fix into the Fedora kernels while we wait for it to be upstreamed?
Comment 13 Neal Gompa 2015-08-13 10:47:15 EDT
Oops, it has been reviewed and declared good[0]. So backporting should be okay too.

[0]: http://www.spinics.net/lists/linux-ext4/msg48740.html
Comment 14 Josh Boyer 2015-08-20 13:58:04 EDT
Added in Fedora git.
Comment 15 Fedora Update System 2015-08-24 17:56:20 EDT
kernel-4.2.0-0.rc8.git0.1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update kernel'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-14151
Comment 16 Fedora Update System 2015-08-27 13:57:27 EDT
kernel-4.2.0-0.rc8.git0.1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 17 Fedora Update System 2015-09-04 21:03:01 EDT
kernel-4.1.6-201.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-15130
Comment 18 Fedora Update System 2015-09-06 14:51:56 EDT
kernel-4.1.6-201.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update kernel'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-15130
Comment 19 Fedora Update System 2015-09-11 13:21:32 EDT
kernel-4.1.6-201.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
Comment 20 Fedora Update System 2015-09-15 13:36:22 EDT
kernel-4.1.7-100.fc21 has been submitted as an update to Fedora 21. https://bodhi.fedoraproject.org/updates/FEDORA-2015-15933
Comment 21 Fedora Update System 2015-09-16 21:02:50 EDT
kernel-4.1.7-100.fc21 has been pushed to the Fedora 21 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update kernel'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-15933
Comment 22 Fedora Update System 2015-09-22 20:20:13 EDT
kernel-4.1.7-100.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.

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