util-linux bug: was Re: [PATCH 00/16 v3] f2fs: introduceflash-friendly file system
From: NeilBrown
Date: Thu Nov 22 2012 - 19:23:20 EST
On Sun, 11 Nov 2012 20:42:48 +0900 Jaegeuk Kim <jaegeuk.kim@xxxxxxxxx> wrote:
> 2012-11-11 (ì), 00:55 +0300, Vyacheslav Dubeyko:
> > Hi,
> >
> > On Nov 10, 2012, at 9:33 PM, Martin Steigerwald wrote:
> >
> > [snip]
> > >
> > > merkaba:~> mkfs.f2fs /dev/sdb1
> > > Info: sector size = 512
> > > Info: total sectors = 4093951 (in 512bytes)
> > > Info: zone aligned segment0 blkaddr: 256
> > > Info: This device doesn't support TRIM
> > > Info: format successful
> > > merkaba:~> mount /dev/sdb1 /mnt/zeit
> > > mount: you must specify the filesystem type
> > > merkaba:~#32> mount -t f2fs /dev/sdb1 /mnt/zeit
> > > merkaba:~> df -hT /mnt/zeit
> > > Dateisystem Typ GrÃÃe Benutzt Verf. Verw% EingehÃngt auf
> > > /dev/sdb1 f2fs 2,0G 147M 1,8G 8% /mnt/zeit
> > >
> >
> > Do you really have trouble with f2fs mount without definition of filesystem type? If so, it is a bug.
>
> Could you explain this bug in mor)e detail?
> Or, can anyone comment this?
>
> Actually, I've looking at the *mount* in linux-utils.
> I suspect something does not support f2fs in linux-utils.
>
This is a bug in util-linux.
If 'blkid' doesn't recognise the filesystem, mount reads /etc/filesystems
and tries everything listed there. If that file ends with a '*', it should
read /proc/filesystems and try everything else listed that (that doesn't
start with 'nodev').
However it currently ignores the '*' and just adds everything
from /proc/filesystems. So the list it uses will have a '*' in the
middle, which will be before 'f2fs' appears.
When it tries each filesystem type in turn, it will abort if it get any error
other than EINVAL.
When it tries with filesystem type '*' it gets 'ENODEV' and so gives up.
The following patch (against git://github.com/karelzak/util-linux.git) fixes
it for me, though I suspect it should possible ignore 'ENODEV' too -
otherwise if /etc/filesystems contains an invalid filesystem name, it will
silently ignore all others.
As a quick hack, just add 'f2fs' to /etc/filesystems
NeilBrown
Signed-off-by: NeilBrown <neilb@xxxxxxx>
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index 624633d..054f266 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -462,6 +462,10 @@ static int get_filesystems(const char *filename, char ***filesystems, const char
continue;
if (sscanf(line, " %128[^\n ]\n", name) != 1)
continue;
+ if (strcmp(name, "*") == 0) {
+ rc = 1;
+ break;
+ }
if (pattern && !mnt_match_fstype(name, pattern))
continue;
rc = add_filesystem(filesystems, name);
@@ -486,7 +490,7 @@ int mnt_get_filesystems(char ***filesystems, const char *pattern)
*filesystems = NULL;
rc = get_filesystems(_PATH_FILESYSTEMS, filesystems, pattern);
- if (rc)
+ if (rc != 1)
return rc;
return get_filesystems(_PATH_PROC_FILESYSTEMS, filesystems, pattern);
}
Attachment:
signature.asc
Description: PGP signature