Gentoo Archives: gentoo-dev

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: rfc: openrc mount service prototype
Date: Mon, 03 Aug 2015 18:51:21
Message-Id: pan$ac818$3c87d80b$eec923a0$75d1add8@cox.net
In Reply to: Re: [gentoo-dev] Re: rfc: openrc mount service prototype by Brian Dolbec
1 Brian Dolbec posted on Mon, 03 Aug 2015 00:59:07 -0700 as excerpted:
2
3 > On Mon, 3 Aug 2015 00:47:24 -0700 Brian Dolbec <dolsen@g.o>
4 > wrote:
5 >>
6 >> On Mon, 3 Aug 2015 00:22:42 -0700 "Daniel Campbell (zlg)"
7 >> <zlg@g.o> wrote:
8 >>
9 >> > I'm having a hard time understanding why we need daemons to handle
10 >> > our filesystems. Can you give me a use case that /etc/fstab is
11 >> > insufficient for solving?
12
13 >> It is about defining proper dependencies and not blindly returning a
14 >> success result when there were actual failures to start some files
15 >> systems.
16 >> So in some ways it is a bugfix. But it is actually a re-design which
17 >> will overcome shortcomings/limitations in the fstab, netmount,
18 >> localmount designs.
19 >
20 > For the average joe user that only has a few fstab entries, /boot,
21 > /root,/home. swap...
22 >
23 > It won't mean much if anything other than an un-needed change. Since it
24 > works for them.
25 >
26 > But for a systems administrator configuring servers with virtual
27 > machines, services depending on certain or multiple filesystems being
28 > up, etc... It can mean a BIG difference. It is the more complicated
29 > systems that are hitting the limitations of the current fstab system.
30 > not the simple user with a standard/basic handbook install.
31
32 [TL;DR folks, skip to last paragraph.]
33
34 Any time there's nested mounts, say /var/log on /var, on /, or /usr/local
35 on /usr, on /, there's dependency issues that the current openrc
36 localmount and netmount services don't deal with explicitly. If it
37 happens to work, great, but sometimes it doesn't.
38
39 Back on openrc, I used to have this problem with some custom bindmounts I
40 did for a chrooted service. They were nested mounts, bind-mounting
41 something that itself was on a separate filesystem, and openrc's
42 localmount just doesn't deal well with that sort of thing, so I had to
43 roll my own latelocalmount service, with the mounts marked noauto so
44 localmount didn't try to mount them before their source filesystems were
45 mounted, then explicitly mounted by name, in the latemount service. If
46 I'd have had multiple layers of nesting, I would have needed multiple
47 layers of mounting services.
48
49 That gets to be a nightmare pretty quickly, all because openrc's existing
50 mount services handle things en-mass, there's no way to explicitly
51 specify dependencies of one mount on others, either at the mount level,
52 or with the service, since individual mount services don't exist, only
53 the en-mass localmount and netmount services. It was and remains a mess.
54
55 To my very pleasant surprise, when I switched to systemd, most of those
56 mounts "just worked", because systemd uses an internally multiplexed
57 individual mount approach instead of the en-mass approach openrc
58 currently uses, and systemd automatically calculates dependencies. The
59 one that systemd did NOT handle correctly by default was because it was a
60 symlink, and apparently systemd's automated dependency handling doesn't
61 deal with symlinks. (Not that I can blame it, symlinks can go circular
62 or dangling, and the calculations get complex pretty quickly. But it
63 handles the non-symlink cases _surprisingly_ well!) And that one had a
64 simple fix, adding a single line to the service unit depending on that
65 mount (it was an early-boot service so had the default deps of all mounts
66 done turned off, but still would have detected the need for the mount
67 based on path, if it was a straight path, not symlinked), making explicit
68 the mount dependency so systemd could follow the dependency logic and
69 would ensure that mount was completed before trying to start the service
70 that depended on it.
71
72
73 Long story short, systemd has upped the expectancy by handling these
74 things automatically in most cases and making it very simple to add
75 explicit mount deps where systemd's automatic handling fails, so other
76 init systems must either match that expectancy now too, or fall further
77 behind. The expectations have changed, and forcing the admin to jump
78 thru a series of complex hack hoops to get nested mounts, etc, working,
79 simply doesn't cut it any more.
80
81 --
82 Duncan - List replies preferred. No HTML msgs.
83 "Every nonfree program has a lord, a master --
84 and if you use the program, he is your master." Richard Stallman