Skip to content

Assorted patches relating to mdmon

NeilBrown linux-raid 2 versions – Applied

Status from this message: Applied, 1, 3-6. Skipping 2 per previous email.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 5 repliesApplied
  2. v16 patches 5 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/6Use existence of /etc/initrd-release to detect initrd.util.c+1 -90 replies
2/6Improvements for IMSM_NO_PLATFORM testing.mdadm.h mdmon.c super-intel.c +1 more+48 -63 replies
3/6mdmon: don't test both 'all' and 'container_name'.mdmon.c+4 -70 replies
4/6mdmon: change systemd unit file to use --foregroundsystemd/[email protected]+1 -20 replies
5/6mdmon: Remove need for KillMode=nonesystemd/[email protected]+6 -10 replies
6/6mdmon: Improve switchroot interactions.Grow.c mdadm.h mdmon.c +3 more+16 -90 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMariusz Tkaczyk
SeriesR-b
1/6
2/6
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH 0/6 v2] Assorted patches relating to mdmon

This series is a minor revision of the previous series with the same name.
It includes the important bugfix identified by Mariusz and a few minor improvements suggested by Paul.

Original comment:

mdmon is a root-storage daemon is the sense defined by systemd documentation, but it does not follow the practice that systemd recommends. Specifically it is run from the root filesystem when possible. The instance started in the initrd hands-over to a root-fs based instance, which then hands-over to an initrd-based instance started by dracut at shutdown.

Part of the reason that we ignore systemd advise is that mdmon needs access to the filesystem - specifically /dev and /sys - which is not available in the initrd context after switchroot. We could possibly change mdmon to work in the systemd-preferred way by splitting mdmon into two processes instead of just having 2 threads. The "monitor" process could running entirely in the initrd context, the "manager" process could safely run in the root-fs context, passing newly opened file descriptors to the monitor over a unix-domain socket.

But we aren't there yet and may never be.

For now, mdmon doesn't work correctly. There is no mechanism to ensure a new instance starts after switchroot. Until recently the initrd instance of the systemd mdmon unit would be stopped at switchroot time because udev would temporarily forget about md devices. This would allow the "udevadm trigger" process to start a new instance. udev was recently fixed:

Commit: 7ec624147a41 ("udevadm: cleanup-db: don't delete information for kept db entries")

so now the attempt to start mdmon via "udevadm trigger" does nothing as mdmon already has an active unit.

The net result is that mdmon continues running in the initrd mount namespace and so cannot access new devices. Adding a device to a root md array that depends on mdmon will no longer work.

We want the initrd instance of mdmon to continue running until the root-fs based instance starts, and that really requires we have two different systemd units. This series achieves this in the final patch by using a different instance name inside or initrd and outside. "initrd-mdfoo" and "mdfoo".

Other patches in the series are mostly clean-ups and minor improvements in related code.

NeilBrown

---

NeilBrown (6):
Use existence of /etc/initrd-release to detect initrd. Improvements for IMSM_NO_PLATFORM testing.
mdmon: don't test both 'all' and 'container_name'.
mdmon: change systemd unit file to use --foreground
mdmon: Remove need for KillMode=none
mdmon: Improve switchroot interactions.

 Grow.c                    |  4 ++--
 mdadm.h                   |  4 +++-
 mdmon.c                   | 22 +++++++++++++-------
 super-intel.c             | 43 ++++++++++++++++++++++++++++++++++++---
 systemd/[email protected]    | 15 +++++++-------
 udev-md-raid-arrays.rules |  3 ++-
 util.c                    | 17 +++++-----------
 7 files changed, 75 insertions(+), 33 deletions(-)

--
Signature