Bug 162927

Summary: blkid: poor ext2 revalidate
Product: [Fedora] Fedora Reporter: Michal Jaegermann <michal>
Component: e2fsprogsAssignee: Karel Zak <kzak>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: kzak, sct
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-05 13:44:41 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:
Attachments:
Description Flags
blkid ext2 probe bug fix patch none

Description Michal Jaegermann 2005-07-11 18:11:58 UTC
Description of problem:

Up to now mount if given an ext3 file system in a command like that
'mount /dev/hda1 /mount/point' was mounting that as ext3.  In rawhide
this results in ext2 mount with the following warning in logs:

EXT2-fs warning (device hda1): ext2_fill_super: mounting ext3 filesystem as ext2

Strace confirms that ext3 is not even tried despite that /etc/filesystems
does exist and lists ext3 before ext2.  One needs to add '-t ext3' explicitely
for filesystems to be mounted that way.

Version-Release number of selected component (if applicable):
util-linux-2.12p-10

How reproducible:
always

Comment 1 Karel Zak 2005-07-12 10:47:29 UTC
The mount uses /proc/filesystem for unknown (=known for kernel) filesystems
only. The standard FS should be recognized by libblkid (from e2fsprogs package).

I can't reproduce it on FC4 where is almost same util-linux and e2fsprogs package.

Comment 2 Michal Jaegermann 2005-07-12 15:40:11 UTC
> The mount uses /proc/filesystem ...

We are talking about /etc/filesystems.  Quoting from a description of
an option '-t' in 'man mount'

              Otherwise,  mount  guesses  itself by probing the superblock; if
              that does not turn up anything that looks familiar,  mount  will
              try  to  read  the  file  /etc/filesystems, or, if that does not
              exist, /proc/filesystems.

and the next paragraph talks about how a probe ordering is affected.

> I can't reproduce it on FC4

Unfortunately I do no have a suitable FC4 installation where I could try
that but indeed on FC3 ext3 file systems are mounted ext3 and not ext2 without
beeing explicit.  But before lines quoted from the manpage there is:

                                                   .... If mount was compiled
              with the blkid library, the guessing is done  by  this  library.

Maybe this is what changed?  It seems to come from  e2fsprogs-1.37-4 on my
test system.

Oh, I see.  Something wrote /etc/blkid.tab.  If I will 'blkid /dev/sda7', which
reads this file, then I see

/dev/sda7: LABEL="spare" UUID="f8e4c33d-6f57-4a30-a51c-adcbddd3c5a0"
SEC_TYPE="ext3" TYPE="ext2"

but if I will do instead 'blkid -c /dev/null /dev/sda7' then I am getting

/dev/sda7: LABEL="spare" UUID="f8e4c33d-6f57-4a30-a51c-adcbddd3c5a0"
SEC_TYPE="ext2" TYPE="ext3"

which is different.  After rewriting /etc/blkid.tab in the following way

     blkid -c /dev/null > /etc/blkid.tab

I can do 'mount /dev/sda7 /mount/point' and indeed it mounts as ext3.
The catch seesm to be that apparently something rewrites /etc/blkid.tab
on some occasions.
   

Comment 3 Karel Zak 2005-07-12 19:00:49 UTC
Please, try:

rm -f /etc/blkid.tab
mount /dev/sda7 /mount/point





Comment 4 Michal Jaegermann 2005-07-12 19:56:19 UTC
Action from comment #3 do work and ext3 systems are not mounted as ext2.
Runnning 'mount' creates a new /etc/blkid.tab file which differs from
the one which I rebuild with 'blkid -c /dev/null > /etc/blkid.tab' only
in time fields.

It looks like that every invocation of 'mount' rewrites /etc/blkid.tab,
hence a reboot too, but types of filesystems are kept.

This constant rewrites could be a bother with / mounted read-only.

Comment 5 Karel Zak 2005-07-13 12:24:18 UTC
I found a problem. The libblkid doesn't check for journal when revalidate the
cache information about an ext2 device.

# rm -f /etc/blkid.tab

# mkfs.ext2 /dev/loop0 &> /dev/null
# blkid -s TYPE /dev/loop0
/dev/loop0: TYPE="ext2"

# mkfs.ext3 /dev/loop0 &> /dev/null
# blkid -s TYPE /dev/loop0
/dev/loop0: TYPE="ext2"

That bug doesn't appear when libblkid creates new cache and checks for all
possible filesystems, because it tries ext3 before ext2. BUT when the library
only revalidate the cache it first probes for old cached filesystem (e.g. ext2).


Comment 6 Karel Zak 2005-07-13 12:28:37 UTC
Created attachment 116706 [details]
blkid ext2 probe bug fix patch

Comment 7 Michal Jaegermann 2005-07-13 23:30:35 UTC
A stupid question (as I was not testing that).  What libblkid will do with
removable media, like /dev/fd0, where the next file system to mount may not
have anything in common with the previous one?  Users cannot pass options
to mount and floppies are not handled by hotplug.  One may possibly find
some hooks to override caches with CDs.  Or these things will be never cached?

Comment 8 Karel Zak 2005-07-14 07:33:15 UTC
to comment #7: it's same for all devices:

1. check device for cached FS  

   + --> FS is still same:
         2. call mount()
         3. update cache (TIME field only)
         4. exit()

   - --> or:
         2. determine actual FS on device
         3. call mount()
         3. update cache
         3) exit()

I think it's pretty reliable.

Comment 9 Michal Jaegermann 2005-07-14 15:40:02 UTC
> 1. check device for cached FS
>    + --> FS is still same:
....

Ah, you mean that only this check was failing when ext2 was in cache, for
whatever reasons, and FS was ext3.  Makes sense.  Thanks!