[systemd-devel] [PATCH] fstab-generator: local-fs.target waits for nofail mounts

Vivek Goyal vgoyal at redhat.com
Mon Apr 7 12:10:14 PDT 2014


On Mon, Apr 07, 2014 at 10:07:20PM +0400, Andrey Borzenkov wrote:
> В Mon, 7 Apr 2014 13:40:17 -0400
> Vivek Goyal <vgoyal at redhat.com> пишет:
> 
> > 
> > Defining a new target which by default waits for all the local fs target
> > sounds interesting. Again, I have the question, what will happen to 
> > local-fs-all.target if some device does not show up and say one of the
> > mounts specified in /etc/fstab fails.
> > 
> > What we want is.
> > 
> > - Wait for all devices to show up as specified in /etc/fstab. Run fsck
> >   on devices. Mount devices to mount points specified.
> > 
> > - If everything is successful, things are fine and local-fs-all.target
> >   will be reached.
> > 
> > - If some device does not show up, or if fsck fails or mount fails, still
> >   local-fs-all.target should reach so that kdump module can detect that
> >   failure happened and can take alternative action.
> >  
> 
> You can use OnFailure= to define unit(s) started when
> local-fs-all.target fails. But it sounds like you are not really
> interested in *all* filesystems, but in specific fileststems defined in
> kdump configuration.

Kdump scripts registers with dracut as pre-pivot hook. And I believe
that in initramfs environments /etc/fstab does not contain all
filesystems. It prmarily contains root and any file system specified
on dracut command line using --mount option during initramfs generation.

So my understanding that given the fact that /etc/fstab is minimal in
initramfs, we should be fine waiting for all the fs specified. 

Given the fact that we run under dracut pre-pivot hook callback, I think
dracut-pre-pivot.service wil have to create a dependency to run after
local-fs-all.target is reached.

Now I am not sure who will generate local-fs-all.target. If dracut
generates it then dracut will also specify OnFailure=. Question will
still remain how dracut modules will communicate to dracut that what
to run after local-fs-all.target fails.

In fact if dracut is doing all this, we don't have to create a separate
target. Right now we force "nofail" so that if mount fails, initrd.target
is still reached.

If we can create a separate service to just handle failures, then we
probably should be able to spcify OnFailure=dracut-failure-hander.service
in right file and as modules to register their failure handler hooks
there.

Something like create new hook called pre-pivot-failure and modules
register a hook to handle pre-pivot-failure. Then kdump can get the
control and handle failure.

And this should allow dracut pre pivot service to specify to launch
dracut-failure-handler.service upon failure.

> 
> >   For example,
> > 
> >   Asssume a user wants to save vmcore to nfs destination. Now for whatever 
> >   reason, nfs target could not be mounted. In that case kdump will still
> >   like to get control and alternatively save dump to local root fs.
> > 
> 
> Without knowing details it sounds like RequiresMountsFor is more
> appropriate (and can be set by generator based on actual kdump
> configuration).

I am not sure how is it useful for this case. dracut already generates
all dependencies and puts them in /etc/fstab. And only entries in
/etc/fstab should be which dracut wants. So I guess we should be fine
and not need using RequiresMountsFor.

Thanks
Vivek


More information about the systemd-devel mailing list