mirror_zfs/contrib/dracut/90zfs
Rudd-O b0f578a807 Use a different technique to detect whether to mount-zfs
The behavior of the Dracut module was very wrong before.

The correct behavior: initramfs should not run `zfs-mount` to completion
if the two generator files exist.  If, however, one of them is missing,
it indicates one of three cases:

* The kernel command line did not specify a root ZFS file system, and
  another Dracut module is already handling root mount (via systemd).
  `mount-zfs` can run, but it will do nothing.
* There is no systemd to run `sysroot.mount` to begin with.
  `mount-zfs` must run.
* The root parameter is zfs:AUTO, which cannot be run in sysroot.mount.
  `mount-zfs` must run.

In any of these three cases, it is safe to run `zfs-mount` to completion.

`zfs-mount` must also delete itself if it determines it should not run,
or else Dracut will do the insane thing of running it over and over again.
Literally, the definition of insanity, doing the same thing that did not
work before, expecting different results.  Doing that may have had a great
result before, when we had a race between devices appearing and pools
being mounted, and `mount-zfs` was tasked with the full responsibility
of importing the needed pool, but nowadays it is wrong behavior and
should be suppressed.

I deduced that self-deletion was the correct thing to do by looking at
other Dracut code, because (as we all are very fully aware of) Dracut
is entirely, ahem, "implementation-defined".

Tested-by: @wphilips 
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Manuel Amador (Rudd-O) <rudd-o@rudd-o.com>
Closes #5157 
Closes #5204
2016-10-06 10:26:47 -07:00
..
.gitignore A collection of dracut fixes 2016-05-12 14:31:15 -07:00
export-zfs.sh.in Move dracut directory to contrib 2015-07-09 13:59:37 -07:00
Makefile.am Set proper dependency for string replacement targets 2016-08-02 10:28:29 -07:00
module-setup.sh.in Fix regression that broke dracut initramfs generation 2016-09-21 13:35:16 -07:00
mount-zfs.sh.in Use a different technique to detect whether to mount-zfs 2016-10-06 10:26:47 -07:00
parse-zfs.sh.in Fix the test to use the variable 2016-05-13 20:44:03 -07:00
zfs-generator.sh.in Use a different technique to detect whether to mount-zfs 2016-10-06 10:26:47 -07:00
zfs-lib.sh.in A collection of dracut fixes 2016-05-12 14:31:15 -07:00