mount nofail: what failures should we allow ?
i've received two requests for the "nofail" option. the doc for the option is a bit ... terse ... so it's hard to guess at the overall intention.
(1) ignore ENOMEDIUM like:sys-utils/mount.c could be updated to do:
case ENOMEDIUM:
if (uflags & MNT_MS_NOFAIL)
return MOUNT_EX_SUCCESS;
warnx(_("no medium found on %s"), src);
break;this is for cases like cd/dvd drives which happens to have no disk loaded.
(2) ignore unknown fs types. e.g. when a kernel config/module is missing support for the requested filesystem type. so a fstab entry like:
..src.. /mnt/foo somefs defaults,nofail
rather than error out with:
mount: unknown filesystem type 'somefs'
it would just issue a warning like it does for other nofail options.
if we go this route though, how far should we take it ? should we make all failures when nofail is active the same ? i'm kind of leaning that way ...
-mike
Karel Zak
maintainerQuoted 3 lines · Mike Frysinger
i've received two requests for the "nofail" option. the doc for the option is a bit ... terse ... so it's hard to guess at the overall intention.
man mount:
nofail Do not report errors for this device if it does not exist.
from my point of view this description is pretty explicit :-)
Quoted 8 lines
(1) ignore ENOMEDIUM like:
sys-utils/mount.ccould be updated to do:case ENOMEDIUM: if (uflags & MNT_MS_NOFAIL) return MOUNT_EX_SUCCESS; warnx(_("no medium found on %s"), src); break;this is for cases like cd/dvd drives which happens to have no disk loaded.
It seems like a good idea, send patch :-)
Quoted 6 lines
(2) ignore unknown fs types. e.g. when a kernel config/module is missing support for the requested filesystem type. so a fstab entry like:
..src../mnt/foosomefs defaults,nofail
rather than error out with:
mount: unknown filesystem type 'somefs'
it would just issue a warning like it does for other nofail options.
I'm not sure with this. It's unusual situation when any filesystem is unknown for libblkid, but it's pretty common that kernel returns EINVAL. This happen when a kernel config/module is missing, but also if you specify wrong mount options and in some another situations. I don't think we want to hide such problems. It's too generic...
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 9 lines · Karel Zak
Quoted 3 lines · Mike Frysinger
i've received two requests for the "nofail" option. the doc for the option is a bit ... terse ... so it's hard to guess at the overall intention.
man mount:
nofail Do not report errors for this device if it does not exist.from my point of view this description is pretty explicit :-)
does it mean the device node doesn't exist (ENOENT) ? or does it also accept the node being there, but returning other errors like ENXIO (the driver isn't loaded) or ENOTDIR (bad path) or ENOTBLK (used a bad path like /dev/zero) or ENOMEDIUM (the node & hardware exists, but is not loaded) ? there's probably other errno values you could catch here.
surely you agree that "does not exist" does not cover all these cases. or at the very least, it's pretty ambiguous/fuzzy.
Quoted 7 lines
Quoted 6 lines
(2) ignore unknown fs types. e.g. when a kernel config/module is missing support for the requested filesystem type. so a fstab entry like:
..src../mnt/foosomefs defaults,nofail
rather than error out with:
mount: unknown filesystem type 'somefs'
it would just issue a warning like it does for other nofail options.
Quoted 5 lines
I'm not sure with this. It's unusual situation when any filesystem is unknown for libblkid, but it's pretty common that kernel returns EINVAL. This happen when a kernel config/module is missing, but also if you specify wrong mount options and in some another situations. I don't think we want to hide such problems. It's too generic...
i think there's a lot going on in this response. let me distill it a bit. if i have a reiserfs that is usable, but i forgot to enable or load the reiserfs kernel driver, should nofail be allowed to skip ? or is this a hard failure ?
-mike
PATCH 1/1 mount: allow nofail to silence ENOMEDIUM cases
In reply to Mike FrysingerAllow people to use nofail to ignore empty cd/dvd drive errors.
URL: https://bugs.gentoo.org/559356
--- sys-utils/mount.c | 3 +++ 1 file changed, 3 insertions(+)
sys-utils/mount.c +3 -0
@@ -628,6 +628,9 @@ try_readonly:break ;case ENOMEDIUM : +if (uflags &MNT_MS_NOFAIL ) +return MOUNT_EX_SUCCESS ; +warnx (_ ("no medium found on %s" ), src);break ;
Signature · 1 line
2.6.2
Re: [PATCH] mount: allow nofail to silence ENOMEDIUM cases
Quoted 2 lines · Mike Frysinger
sys-utils/mount.c | 3 +++ 1 file changed, 3 insertions(+)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Karel Zak
maintainerQuoted 11 lines · Mike Frysinger
Quoted 9 lines · Karel Zak
Quoted 3 lines · Mike Frysinger
i've received two requests for the "nofail" option. the doc for the option is a bit ... terse ... so it's hard to guess at the overall intention.
man mount:
nofail Do not report errors for this device if it does not exist.from my point of view this description is pretty explicit :-)
Quoted 8 lines
does it mean the device node doesn't exist (ENOENT) ? or does it also accept the node being there, but returning other errors like ENXIO (the driver isn't loaded) or ENOTDIR (bad path) or ENOTBLK (used a bad path like
/dev/zero) or ENOMEDIUM (the node & hardware exists, but is not loaded) ? there's probably other errno values you could catch here.surely you agree that "does not exist" does not cover all these cases. or at the very least, it's pretty ambiguous/fuzzy.
now we use "nofail" if:
- impossible to translate UUID/LABEL/etc to device name
- mount(2) returns ENOENT and stat() on source fails
- mount(2) returns ENOTDIR and stat() on source fails with ENOTDIR
- mount(2) returns ENOTBLK
- mount(2) returns ENXIO
- and ENOMEDIUM now
... well, maybe we can improve the description in the man page to make it more user friendly.
Quoted 13 lines
Quoted 7 lines
Quoted 6 lines
(2) ignore unknown fs types. e.g. when a kernel config/module is missing support for the requested filesystem type. so a fstab entry like:
..src../mnt/foosomefs defaults,nofail
rather than error out with:
mount: unknown filesystem type 'somefs'
it would just issue a warning like it does for other nofail options.Quoted 5 lines
I'm not sure with this. It's unusual situation when any filesystem is unknown for libblkid, but it's pretty common that kernel returns EINVAL. This happen when a kernel config/module is missing, but also if you specify wrong mount options and in some another situations. I don't think we want to hide such problems. It's too generic...
Quoted 4 lines
i think there's a lot going on in this response. let me distill it a bit. if i have a reiserfs that is usable, but i forgot to enable or load the reiserfs kernel driver, should nofail be allowed to skip ? or is this a hard failure ?
Now it's hard failure and I'm fine with it ;)
In this case kernel returns EINVAL -- the problem is that kernel uses EINVAL it in another situations too. It makes "nofail" very problematic for this use-case, because we're not able to detect that you have no reiserfs driver.
Frankly, people will ask for "nofail" extension all time...
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com