Gentoo Archives: gentoo-dev

From: Ian Stakenvicius <axs@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] rfc: improve file system mounting and unmounting in OpenRC
Date: Tue, 04 Aug 2015 21:18:07
Message-Id: 55C12BFF.8070405@gentoo.org
In Reply to: Re: [gentoo-dev] rfc: improve file system mounting and unmounting in OpenRC by William Hubbs
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA256
3
4 On 04/08/15 04:40 PM, William Hubbs wrote:
5 > On Tue, Aug 04, 2015 at 02:05:12PM -0400, Ian Stakenvicius wrote:
6 >> 1 - if localmount fails, the you end up with everything that
7 >> currently 'need's localmount failing -- this means if you have a
8 >> headless server someplace that reboots, you may not end up with
9 >> an sshd to connect into it just to fix some random localmount
10 >> failure that might not be needed for the core system. So, no, I
11 >> would not like to see localmount failing unless all other
12 >> services are adjusted to no longer need localmount to
13 >> succeed.[**]
14 >
15 > This sounds like more an issue with which file systems are critical
16 > for mounting, and a good argument for getting rid of localmount.
17 >
18 > If we don't care whether localmount succeeds or not, the need
19 > dependency is the wrong one to use.
20 >
21 > Maybe we do think certain file systems must be mounted to boot
22 > successfully, and if we do, those should have need dependencies
23 > and cause failure if they are unable to be mounted, but the others
24 > should not.
25 >
26 > This is a good reason in itself to move away from localmount and
27 > netmount.
28 >
29 >
30
31 You may have misunderstood what I meant here.
32
33 Right now, most if not all services expect localmount to have
34 completed successfully before they will start, right? That's the
35 whole reason why localmount as it is now doesn't fail. What you are
36 suggesting here is to make it fail. It doesn't matter whether we use
37 the per-mount service underneath localmount or keep it as a "mount -a"
38 wrapper, in both cases when "localmount" fails we get failures and
39 services wont start.
40
41 So what you are suggesting here now is that you want to (A)
42 potentially break mounting with the need to externally manage mounts
43 via services in openrc instead of just using /etc/fstab, and (B) also
44 break services if something doesn't start, which is one of the reasons
45 why you wanted to go through with this per-mount service in the first
46 place. My point is that no, we should keep localmount as succeeding
47 even if one of the dependent services fails to mount, *just like it
48 does right now*, *for the same reasons* as it succeeds on failure
49 right now.
50
51
52
53 >>
54 >> Other implementation related questions:
55 >>
56 >> 2 - dependencies in other services: right now we have things
57 >> that need localmount. These will need to be mapped, iirc the
58 >> prototype fork maps them to mount.usr and mount.var instead of
59 >> 'localmount'. So what happens in the case that everything is on
60 >> a single filesystem -- that is, there is no separate mount.usr /
61 >> mount.var? Dependencies break in that case, no? Or will a
62 >> parent mount point 'provide' the subdirectory tree to satisfy
63 >> these mounts? Or will there be a totally different means of
64 >> mapping filesystem parts a service needs with the mount points
65 >> that need to be mounted first? How specific will the needs of a
66 >> service need to be in terms of its mount dependencies in order to
67 >> safely start, if for instance there is no more assurance that
68 >> 'localmount' has started or has successfully finished?
69 >
70 > My thought on this is that if you have a mount.foobar service and
71 > its mountpoint is not listed in fstab, the service would output a
72 > message and return success. This should cover the case of a file
73 > system being needed but not being a real file system.
74 >
75 > From the user's side, you could, if everything was on a single
76 > file system, just use rc_need in /etc/conf.d/* to remove mount.usr
77 > and mount.var from everything.
78 >
79
80 But what services will shipped init scripts be specifying in
81 depend()?? mount.usr and mount.var are (A) only true in certain cases
82 (things can just as easily be /var/lib , /var/log , /usr/share , etc),
83 and (B) outright wrong if someone just has everything on one root
84 filesystem. Are you suggesting now that not only will everyone have
85 to set up their services / sync them with /etc/fstab but they'll also
86 have to set all mount-point dependencies in their services too?
87
88
89
90 >> 3 - dynamic creation of services -- as of right now, openrc needs
91 >> all services to exist as files/symlinks in /etc/init.d. Is it a
92 >> good idea for a script to be regularly messing with /etc/init.d ?
93 >> Or will openrc be changed to have a whole new means of
94 >> registering dynamically-created services?
95 >
96 > To be honest, I am not really a fan of dynamically created
97 > services; I would rather not go there. We don't do that for net.*,
98 > so I don't think we should for mount.*.
99 >
100 >> 4 - Dealing with dynamic creation of services at bootup --
101 >> openrc currently generates/refreshes the cache on shutdown or
102 >> during config changes so that it doesn't have to do it on
103 >> startup, thus speeding up startup. Since /etc/fstab could have
104 >> changed between shutdown and startup (and likely not with a
105 >> chroot involved -- say, after moving partitions around in a
106 >> livecd env) then fstab won't match the services (nor the cache)
107 >> anymore. At best this would likely mean cache regeneration, at
108 >> worst it means the services need to be regenerated first. And
109 >> then there's the issue of the strictness of the misaligned
110 >> mount.* services in the depend() of other services (#1) upon
111 >> first boot of the new /etc/fstab.
112 >
113 > I'm not exactly sure what the answer would be here, except that
114 > you would have to keep the symlinks in sync with fstab.
115 >
116 > I'm thinking that there will be a couple of defaults (mount.usr
117 > and mount.var) that will take care of most situations.
118 >
119
120
121 And this is why I am -not- a fan of this being the default
122 implementation of mounting in openrc (and -definitely- not the only
123 one). A single service for local mounting, whether it be 'mount -a'
124 or internally mounting each filesystem individually, allows
125 practically all mounting to be completed in a service-agnostic manner.
126 To properly set up mounting otherwise simply requires too much work,
127 way more than should be necessary. Its pretty much the same as
128 dropping 'net' from depend in favour of forcing end-users to set up
129 rc_need='net.[iface]' on their own, only an order of magnitude worse.
130
131 Realistically, I think it would be better for openrc to handle this
132 new mounting separately from /etc/fstab if the end-user is expected to
133 manage it themselves as is described above, at least then there won't
134 be any confusion about this new per-service mounting being an openrc
135 thing and not something meant to work in any sort of linux-generic
136 manner like what one would expect from using /etc/fstab.
137
138 Otherwise, IMO, openrc needs to provide mounting from /etc/fstab and
139 /etc/fstab alone, not requiring the end-user to sync things by hand or
140 otherwise. And to do that cleanly IMO requires a rather large amount
141 of changes to some rather core portions of openrc in order to
142 implement dynamic services and/or non-service depend(s), and make
143 cache generation and cache usage work alongside them.
144
145
146 -----BEGIN PGP SIGNATURE-----
147 Version: GnuPG v2
148
149 iF4EAREIAAYFAlXBK/8ACgkQAJxUfCtlWe3ZOwD+MmQUdhsGEnPtBgmBh7VEeOnc
150 YHA/8d+fCgqQM5aveZEA/AgJ7MjIcgs3Dctd6OQJZkeW9hoibBK32bfuM2GA3C6b
151 =qZAT
152 -----END PGP SIGNATURE-----

Replies

Subject Author
[gentoo-dev] Re: rfc: improve file system mounting and unmounting in OpenRC Duncan <1i5t5.duncan@×××.net>