zfs-0.6.1-gentoo-openrc-dependencies.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. commit 75c2fb953c99bba008f1ef72ee71136002749f51
  2. Author: Richard Yao <ryao@cs.stonybrook.edu>
  3. Date: Tue May 28 20:08:15 2013 -0400
  4. Improve OpenRC init script
  5. The current zfs OpenRC script's dependencies cause OpenRC to attempt to
  6. unmount ZFS filesystems at shutdown while things were still using them,
  7. which would fail. This is a cosmetic issue, but it should still be
  8. addressed. It probably does not affect systems where the rootfs is a
  9. legacy filesystem, but any system with the rootfs on ZFS needs to run
  10. the ZFS init script after the system is ready to shutdown filesystems.
  11. OpenRC's shutdown process occurs in the reverse order of the startup
  12. process. Therefore running the ZFS shutdown procedure after filesystems
  13. are ready to be unmounted requires running the startup procedure before
  14. fstab. This patch changes the dependencies of the script to expliclty
  15. run before fstab at boot when the rootfs is ZFS and to run after fstab
  16. at boot whenever the rootfs is not ZFS. This should cover most use
  17. cases.
  18. The only cases not covered well by this are systems with legacy
  19. root filesystems where people want to configure fstab to mount a non-ZFS
  20. filesystem off a zvol and possibly also systems whose pools are stored
  21. on network block devices. The former requires that the ZFS script run
  22. before fstab, which could cause ZFS datasets to mount too early and
  23. appear under the fstab mount points. The latter requires that the ZFS
  24. script run after networking starts, which precludes the ability to store
  25. any system information on ZFS. An additional OpenRC script could be
  26. written to handle non-root pools on network block devices, but that will
  27. depend on user demand and developer time.
  28. Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
  29. diff --git a/etc/init.d/zfs.gentoo.in b/etc/init.d/zfs.gentoo.in
  30. index 5b8671e..0034e02 100644
  31. --- a/etc/init.d/zfs.gentoo.in
  32. +++ b/etc/init.d/zfs.gentoo.in
  33. @@ -10,9 +10,16 @@ fi
  34. depend()
  35. {
  36. + # Try to allow people to mix and match fstab with ZFS in a way that makes sense.
  37. + if [ "$(mountinfo -s /)" = 'zfs' ]
  38. + then
  39. + before localmount
  40. + else
  41. + after localmount
  42. + fi
  43. +
  44. # bootmisc will log to /var which may be a different zfs than root.
  45. - before net bootmisc
  46. - after udev localmount
  47. + before bootmisc logger
  48. keyword -lxc -openvz -prefix -vserver
  49. }