Bug 637920 - blkid: caching fixes for tag search ("blkid -l -t LABEL=" returns empty results)
Summary: blkid: caching fixes for tag search ("blkid -l -t LABEL=" returns empty results)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: e2fsprogs
Version: 5.5
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Eric Sandeen
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks: 640584
TreeView+ depends on / blocked
 
Reported: 2010-09-27 18:28 UTC by Bryn M. Reeves
Modified: 2018-11-14 19:50 UTC (History)
5 users (show)

Fixed In Version: e2fsprogs-1.39-25.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-21 09:06:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1080 0 normal SHIPPED_LIVE e2fsprogs bug fix and enhancement update 2011-07-21 09:04:54 UTC

Description Bryn M. Reeves 2010-09-27 18:28:01 UTC
Description of problem:
Under some circumstances blkid may return empty results for devices that exist on the system when stale entries for the same search tag exist.

This can occur during booting when /etc is on a read-only file system. In this situation the failure to resolve a label may prevent the system from booting due to a failed fsck or mount attempt.

In the case that blkid.tab is read-only and there are at least three stale devices listed in the file blkid fails to return a result. If 

Version-Release number of selected component (if applicable):
e2fsprogs-1.39-23.el5

How reproducible:
100%

Steps to Reproduce:
1. Make sure at least three stale entries are present in the cache and that no valid entry exists, e.g.:

<device DEVNO="0x0701" TIME="1285610290" LABEL="loop0" UUID="20fdfb4c-f7e7-4628-ae48-b37026a38806" TYPE="ext3">/dev/loop1</device>
<device DEVNO="0x0702" TIME="1285610290" LABEL="loop0" UUID="20fdfb4c-f7e7-4628-ae48-b37026a38806" TYPE="ext3">/dev/loop2</device>
<device DEVNO="0x0703" TIME="1285610290" LABEL="loop0" UUID="20fdfb4c-f7e7-4628-ae48-b37026a38806" TYPE="ext3">/dev/loop3</device>

(the device is really /dev/loop0)
  
2. Make /etc/blkid/blkid.tab read-only
(e.g. mount -oremount,ro /etc/blkid if separate fs, chattr +i otherwise)

3. blkid -l -t LABEL=loop0

Actual results:
< no output>


Expected results:
/dev/loop0: LABEL="loop0" UUID="20fdfb4c-f7e7-4628-ae48-b37026a38806" TYPE="ext3"

Additional info:
The scenario (minimum of three stale entries) seems a little unlikely but is actually not that uncommon on multipath systems in FC environments (many single-path devices with the same label that are assigned to different sd* device nodes on each boot).

This has already been fixed upstream in the following two commits:

commit bf58e3d1c68be63d673d232154bde5854e031afc
Author: Theodore Ts'o <tytso>
Date:   Sat Jun 28 22:09:43 2008 -0400

    blkid: Eliminate stale entries that duplicate a verified device
    
    Addresses-Debian-Bug: #487758, #487783
    
    Signed-off-by: "Theodore Ts'o" <tytso>

commit b697f9d01c5f07842426f7d8e918bf3110028662
Author: Theodore Ts'o <tytso>
Date:   Sat Jun 28 21:02:01 2008 -0400

    blkid: Make sure a device returned by blkid_find_dev_with_tag exists
    
    There could be stale entries in blkid file, so if the device does not
    exist, skip it.
    
    Addresses-Debian-Bug: #487758, #487783
    
    Signed-off-by: "Theodore Ts'o" <tytso>

The following patch was merged around the same time and avoids a segfault if we include the changes for bug 563909:

commit 772b89d34212e4b36c2025c80304e166bc25a2f3
Author: Eric Sandeen <sandeen>
Date:   Fri Jun 20 22:32:49 2008 -0500

    blkid: use list_for_each_safe in garbage collection
    
    We need to use list_for_each_safe in case a device gets removed from
    the list during garbage collection.
    
    Also make the manpage slightly more informative about
    what the -g garbage collection option does.
    
    Addresses-Debian-Bug: #487758, #487783
    
    Signed-off-by: Eric Sandeen <sandeen>
    Signed-off-by: Theodore Ts'o <tytso>

Comment 5 Eric Sandeen 2010-09-29 17:28:37 UTC
bb47c2a4aff6ec6b9be7f30cd04cf7c858a84de4 should be added on top of bf58e3d1c68be63d673d232154bde5854e031afc as well.

commit bb47c2a4aff6ec6b9be7f30cd04cf7c858a84de4
Author: Theodore Ts'o <tytso>
Date:   Sun Jul 13 19:10:10 2008 -0400

    libblkid: Make sure we never reference a null dev->bid_type
    
    There were a few places where we don't check to make sure
    dev->bid_type is non-NULL before dereferencing the pointer, mostly in
    debug code.
    
    Signed-off-by: "Theodore Ts'o" <tytso>


I'm not quite sure about the reference in the original comment to bug 563909; are those changes being requested as well?

Thanks,
-Eric

Comment 6 Bryn M. Reeves 2010-09-30 15:36:53 UTC
Hey Eric,

No - there's requirement for blkid GC to fix the problem reported in this BZ.

 Commit 772b89d34212e4b36c2025c80304e166bc25a2f3 was mentioned in a bunch of commits that came from a Debian bugzilla by one of the guys who was working on this case for GSS.

I dropped it from my testing since it was clear that it wasn't required to fix the problem reported here but thought I'd mention it since if we do take the changes for bug 563909 it would be good to get this one as well (and also the commit you mention in comment #5).

Kudos to Anders Rayner-Karlsson & Gary Smith for doing most of the spade work on this one.

Thanks,

Comment 7 Bryn M. Reeves 2010-09-30 15:37:32 UTC
That should read there is _no_ requirement for blkid GC to fix the problem reported in this BZ. Can't type today...

Comment 8 Eric Sandeen 2010-10-05 15:40:58 UTC
Built in e2fsprogs-1.39-25.el5

Comment 14 errata-xmlrpc 2011-07-21 09:06:38 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-2011-1080.html

Comment 15 errata-xmlrpc 2011-07-21 12:39:05 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-2011-1080.html


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