Bug 575734 - use microsecond resolution for blkid cache entries
Summary: use microsecond resolution for blkid cache entries
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux-ng
Version: 13
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-03-22 09:36 UTC by Karel Zak
Modified: 2010-04-12 18:51 UTC (History)
9 users (show)

Fixed In Version: util-linux-ng-2.17.2-1.fc13
Clone Of: 572937
Environment:
Last Closed: 2010-04-09 04:16:20 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Karel Zak 2010-03-22 09:36:33 UTC
+++ This bug was initially created as a clone of Bug #572937 +++

Description of problem:

The commands which fail are:

/sbin/mke2fs -O journal_dev -b 4096 -U 298765c4-c6a7-49a6-b53b-9df92aad9ebe /dev/vda1

/sbin/mke2fs -t ext2 -J device=UUID=298765c4-c6a7-49a6-b53b-9df92aad9ebe -b 4096 /dev/vda2

It's unclear from the error message (see bug 572935), but this is in fact
caused because the journal device hasn't been created / settled by the
time the second command starts running.  The real error therefore is
that the device does not exist.  (A call to udevsettle should fix this).

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

libguestfs 1.0.85.

How reproducible:

Sometimes.

Steps to Reproduce:
1. make -C capitests check

--- Additional comment from rjones on 2010-03-12 07:13:40 EST ---

Hmmm udev settle doesn't fix this.  Is there a blkid settle?

--- Additional comment from bmr on 2010-03-12 07:31:46 EST ---

Can't reproduce this on usb-storage devices. Can you post the full output from the commands (with -v although it doesn't seem to add much in this case)?

Does the data eventually end up on the device? E.g. if you sync(2) or sleep a bit between 1 & 2?

Is there anything unusual about the environment here? E.g. is /etc read only?

What's the content of /etc/blkid/blkid.tab between 1 & 2?

--- Additional comment from kzak on 2010-03-12 08:06:11 EST ---

The libblkid does not re-verify information from the cache if the device record in the cache is not older than 2 seconds.

The library also checks st_mtime for the device, but this number is in seconds.
 
It would be better to use utimes() to get more precise information about the latest change.

--- Additional comment from chellwig on 2010-03-12 08:41:30 EST ---

Or always use blkid in the raw mode instead of using the buggy cache.

--- Additional comment from esandeen on 2010-03-12 10:01:30 EST ---

I suppose telling mke2fs to use blkid uncached mode wouldn't be too bad - on machines with lots of disks it could take a while, but it's reasonable to expect that mke2fs happened shortly after mke2fs -J so not a lot of other options.

So either option seems ok.  This probably makes it an e2fsprogs bug, so I guess I'll take it ... unless you want to keep this bug open for a sleep(), and make a new one for e2fsprogs in general?

--- Additional comment from rjones on 2010-03-12 10:33:43 EST ---

(In reply to comment #5)
> I suppose telling mke2fs to use blkid uncached mode wouldn't be too bad - on
> machines with lots of disks it could take a while, but it's reasonable to
> expect that mke2fs happened shortly after mke2fs -J so not a lot of other
> options.
> 
> So either option seems ok.  This probably makes it an e2fsprogs bug, so I guess
> I'll take it ... unless you want to keep this bug open for a sleep(), and make
> a new one for e2fsprogs in general?    

I'm still trying to reproduce it in a small test case for me.

It only manifests itself so far in (a) a virtual machine, (b) on
a slow 32 bit laptop, (c) as part of a very large test suite.

I'm not sure exactly what variables do/don't cause it
to happen.

--- Additional comment from rjones on 2010-03-12 10:34:40 EST ---

Although I should add, that under conditions (a) + (b) + (c)
it's pretty reliable to reproduce :-)

--- Additional comment from chellwig on 2010-03-12 10:45:43 EST ---

I don't think there a need to find an always working testcase.  It's a fairly widely known bug, and we've been running into it a lot in xfstests.  In the end we switched to disabling the blkid cache and that sorted it out nicely.

--- Additional comment from kzak on 2010-03-12 10:57:52 EST ---

Here is simple reproducer:

# modprobe scsi_debug dev_size_mb=250 sector_size=512 
# mkfs.ext2 -L FooFoo /dev/sdb

# blkid /dev/sdb; e2label /dev/sdb BarBar; blkid /dev/sdb
/dev/sdb: LABEL="FooFoo" UUID="6f196955-266a-4ad4-89ed-9ce90de5696d" TYPE="ext2" 
/dev/sdb: LABEL="FooFoo" UUID="6f196955-266a-4ad4-89ed-9ce90de5696d" TYPE="ext2"

--- Additional comment from rjones on 2010-03-12 12:49:38 EST ---

I tried sleeping for 3 seconds between statements, but that
didn't help.

Also, looking more closely at my tests I notice that this
related pair of statements always succeeds:

/sbin/mke2fs -O journal_dev -b 4096 -L JOURNAL /dev/vda1
/sbin/mke2fs -t ext2 -J device=LABEL=JOURNAL -b 4096 /dev/vda2

I would expect this version to fail as often as the UUID= version,
but in fact the LABEL= version has never failed.

Therefore I think this problem is more subtle than my understanding
of it at the moment.

--- Additional comment from rjones on 2010-03-12 12:51:32 EST ---

Created an attachment (id=399705)
Detailed log from the test.

This is the log from the test.  It's not really that helpful unfortunately
because some messages to stdout from the commands seem to be
lost.

In any case, search for the word 'FAILED' to see log around the
failing test.

--- Additional comment from rjones on 2010-03-16 18:08:10 EDT ---

(In reply to comment #10)
> I tried sleeping for 3 seconds between statements, but that
> didn't help.
> 
> Also, looking more closely at my tests I notice that this
> related pair of statements always succeeds:
> 
> /sbin/mke2fs -O journal_dev -b 4096 -L JOURNAL /dev/vda1
> /sbin/mke2fs -t ext2 -J device=LABEL=JOURNAL -b 4096 /dev/vda2
> 
> I would expect this version to fail as often as the UUID= version,
> but in fact the LABEL= version has never failed.

I made the LABEL version fail by skipping the preceeding
UUID version.

--- Additional comment from kzak on 2010-03-17 10:30:15 EDT ---

The problem should be fixed in upstream git tree, commit:
http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=commit;h=6c2f2b9d62b196296e827f8bb7336a39e80695a9

Richard, I'd like to create a test rpm for you, fedora-13 or RHEL6? 

Note, the bug is reported against libguestfs, but it seems the bug should be fixed in util-linux-ng (or e2fsprogs if Eric wants to use libblkid without the cache in mke2fs).

--- Additional comment from rjones on 2010-03-17 11:01:02 EDT ---

(In reply to comment #13)
> The problem should be fixed in upstream git tree, commit:
> http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=commit;h=6c2f2b9d62b196296e827f8bb7336a39e80695a9
> 
> Richard, I'd like to create a test rpm for you, fedora-13 or RHEL6? 

I can test F-13, but note my F-13 box is a 32 bit i686 !

> Note, the bug is reported against libguestfs, but it seems the bug should be
> fixed in util-linux-ng (or e2fsprogs if Eric wants to use libblkid without the
> cache in mke2fs).    

Yes, looks like it should be in util-linux-ng or e2fsprogs.

--- Additional comment from esandeen on 2010-03-17 11:04:19 EDT ---

Well, if there's a fix to be had in blkid that'd be more generic.  :)

--- Additional comment from kzak on 2010-03-18 11:04:55 EDT ---

(In reply to comment #14)
> I can test F-13, but note my F-13 box is a 32 bit i686 !

Please, download from:

i686:
  http://koji.fedoraproject.org/koji/taskinfo?taskID=2061240
x86_64:
  http://koji.fedoraproject.org/koji/taskinfo?taskID=2061239

It's scratch build, so the packages will be available for few days only.

--- Additional comment from rjones on 2010-03-19 05:46:08 EDT ---

kzak++ .. This package does appear to have fixed the
problem for me.

--- Additional comment from pm-rhel on 2010-03-22 05:16:39 EDT ---

This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 1 Fedora Update System 2010-03-22 10:12:16 UTC
util-linux-ng-2.17.2-1.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/util-linux-ng-2.17.2-1.fc13

Comment 2 Fedora Update System 2010-03-23 23:28:48 UTC
util-linux-ng-2.17.2-1.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update util-linux-ng'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/util-linux-ng-2.17.2-1.fc13

Comment 3 Richard W.M. Jones 2010-03-30 13:14:17 UTC
Would it be possible to push this fix to Rawhide too?
The libguestfs tests are currently failing in Rawhide for
the same reason, and at the moment F-13 is ahead of
Rawhide:

http://koji.fedoraproject.org/koji/packageinfo?packageID=4906

util-linux-ng-2.17.2-1.fc13	kzak	2010-03-22 10:00:46	
util-linux-ng-2.17.1-2.fc14	kzak	2010-03-11 22:17:10	
[...]

Comment 4 Fedora Update System 2010-04-09 04:16:15 UTC
util-linux-ng-2.17.2-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 5 Karel Zak 2010-04-12 18:51:51 UTC
(In reply to comment #3)
> Would it be possible to push this fix to Rawhide too?

Yes, util-linux-ng-2.17.2-1.fc14.


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