Closed
Bug 1329738
Opened 8 years ago
Closed 8 years ago
/repo/hg/chroot_mozbuild/repo/hg/mozilla bind mount not mounted on startup
Categories
(Developer Services :: Mercurial: hg.mozilla.org, defect)
Developer Services
Mercurial: hg.mozilla.org
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: gps, Assigned: gps)
References
Details
Attachments
(1 file)
The hgweb machines have a bind mount of /repo/hg/mozilla into /repo/hg/chroot_mozbuild/repo/hg/mozilla. The mount is currently defined in Ansible as part of the hg-web role via the "shell" module invoking `mount`. As a result, the mount point isn't remounted after rebooting. This means the moz.build chroot environment requires an Ansible deploy after reboot before it starts working.
We should get this bind mount added to system startup. However, as the comment in the Ansible code explains, this may be more complicated than just an fstab entry:
# In order to get a read-only bind mount, we have to first do a regular
# bind mount then do a remount. We can't work this magic with the
# "mount" ansible module, so do it by hand.
- name: bind mount repositories into mozbuild chroot (servers only)
shell: mount -o bind /repo/hg/mozilla /repo/hg/chroot_mozbuild/repo/hg/mozilla && mount -o remount,ro,bind /repo/hg/mozilla /repo/hg/chroot_mozbuild/repo/hg/mozilla creates=/repo/hg/chroot_mozbuild/repo/hg/mozilla/mozilla-central
needinfo fubar to see if he has any ideas.
Flags: needinfo?(klibby)
Assignee | ||
Comment 1•8 years ago
|
||
I confirmed that executing just these `mount` commands after a reboot is sufficient for the chroot execution environment to work. So AFAICT this is the only thing preventing an hgweb machine from coming back from reboot and "just working."
Comment 2•8 years ago
|
||
http://unix.stackexchange.com/questions/128336/why-doesnt-mount-respect-the-read-only-option-for-bind-mounts has a great rundown on this. It looks like we might actually be able to get away with `mount --bind,ro foo foo`; it's in the mount man page which corresponds to the fix in util-linux (https://git.kernel.org/cgit/utils/util-linux/util-linux.git/commit/?id=9ac77b8a78452eab0612523d27fee52159f5016a).
It might also be possible to stack two fstab entries, though I'm wary of that:
/source/dir /destination/dir none bind 0 0
/source/dir /destination/dir none remount,bind,ro 0 0
If that doesn't work, would suggest going with a cheapo init.d (err, systemctl) script.
Flags: needinfo?(klibby)
Assignee | ||
Comment 3•8 years ago
|
||
I added the dual fstab entry to hgweb11 before a reboot. While the bound mount on reboot worked, the remount as read-only failed: the mount was mounted rw after reboot.
So it looks like we may need a systemctl hack here :/
Assignee | ||
Comment 4•8 years ago
|
||
It turns out that systemd parses fstab and turns it into mounts automagically. See https://www.freedesktop.org/software/systemd/man/systemd.mount.html.
Further sleuthing of the internets reveals that systemd's fstab parser doesn't like the multiple fstab entries. So the hack to do a bind + remount,bind,ro only works without systemd (at least with the systemd currently installed on CentOS).
Furthermore, I couldn't find any evidence that systemd's mount units support a read-only bind mount. I did find evidence suggesting that invoking `mount` twice is the only way to do this.
Assignee | ||
Comment 5•8 years ago
|
||
https://blog.iwakd.de/systemd-fstab-and-bind-mounts-with-options has a write-up of this with long history. I'm going to implement it because this blocks me writing Ansible playbooks for doing a rolling reboot of the hg.mo servers.
Assignee: nobody → gps
Status: NEW → ASSIGNED
Comment hidden (mozreview-request) |
Comment 7•8 years ago
|
||
mozreview-review |
Comment on attachment 8830481 [details]
ansible/hg-web: systemd units to manage repos bind mount (bug 1329738);
https://reviewboard.mozilla.org/r/107240/#review108404
Nice archaeology on that; it's a shame that we have to go this route, but nicely done.
Attachment #8830481 -
Flags: review?(klibby) → review+
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/e7c5874b3f21
ansible/hg-web: systemd units to manage repos bind mount ; r=fubar
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/516025e2ab43
ansible/hg-web: move dev tmpfs mount into own systemd unit file
You need to log in
before you can comment on or make changes to this bug.
Description
•