On Fri, Apr 04, 2014 at 02:44:50PM +0800, WANG Chao wrote:
> In kdump kernel, we need mount certain file system, and we use "nofail"
> for all mounts specified in /etc/fstab. Because we don't want any mount
> failure to interrupt the boot process to arrive at
> dracut-pre-pivot.service (This is the point just before we switch root).
> And at that dracut-pre-pivot, we run our kernel dump capture script
> (called kdump.sh).
> 
> Our kdump.sh needs every .mount is mounted (or started in systemd
> context) before it gets run by dracut-pre-pivot.service. And
> dracut-pre-pivot.service is configured to run after local-fs.target. So
> what we expect is no matter nofail is configured or not, local-fs.target
> should be delayed after all mount units are started.
> 
> And it's also the same for remote nofail mounts and remote-fs.target.

Chao, will this change not force boot to stop if fsck on said device
failed? And in that case we will not get a chance to run "default"
action in kdump.

I think there is conflict in the definiton of "nofail" as defined by
fstab/fsck and as interpreted by systemd fstab generator.

"man fstab" says following.

        nofail do  not  report  errors  for  this  device if it does not exist.

"man fsck" says following.
        fsck  normally does not check whether the device actually exists
        before calling a filesystem specific  checker.   Therefore non-
        existing devices may cause the system to enter filesystem repair
        mode during boot if the filesystem specific  checker returns  a
        fatal  error.  The /etc/fstab mount option nofail may be used to
        have fsck skip non-existing devices.  fsck also skips non-exist‐
        ing devices that have the special filesystem type auto.

To me, that means one will still try to run fsck on the device and continue
if device is not available, instead of forcing an error. I am not sure what
error code fsck returns in this acse.

But systemd seems to be implementing *do not wait for device to mount or
do not wait for fsck results*

****************************************************
http://www.freedesktop.org/software/systemd/man/systemd.mount.html
If nofail is given, this mount will be only wanted, not required, by the
local-fs.target. This means that the boot will continue even if this mount
point is not mounted successfully. Option fail has the opposite meaning
and is the default.
*************************************************

To me systemd seems to be implementing mountall "nobootwait" which seems to 
imply that boot does can continue without this mount being successful.

If I go by fsck definition, nofail will imply that start the unit but
if mount fails, still continue with rest of the units. It does not mean
that other dependent units can be started before starting this unit.

So I think nofail should map force Before=.

What happens if "nofail" is specified and device is present and there
are file system errors. Will fsck continue with boot or drop user into
a shell during boot and force to fix file system failures?

I think we also need an option which tells that continue to start
dependent units even if you failed to mount a filesystem. If "nofail"
semantics implies that, it is fine, otherwise we will have to create
a systemd specific semantic to imply that to meet our needs.

Thanks
Vivek

> ---
>  src/fstab-generator/fstab-generator.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/fstab-generator/fstab-generator.c 
> b/src/fstab-generator/fstab-generator.c
> index a9a5c02..55938b5 100644
> --- a/src/fstab-generator/fstab-generator.c
> +++ b/src/fstab-generator/fstab-generator.c
> @@ -225,7 +225,7 @@ static int add_mount(
>                  "Documentation=man:fstab(5) 
> man:systemd-fstab-generator(8)\n",
>                  source);
>  
> -        if (post && !noauto && !nofail && !automount)
> +        if (post && !noauto && !automount)
>                  fprintf(f, "Before=%s\n", post);
>  
>          if (passno != 0) {
> -- 
> 1.8.5.3
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to