hgmo: handle /boot unmount (bug 1263973); r?kang draft
authorGregory Szorc <gps@mozilla.com>
Fri, 21 Oct 2016 12:54:52 -0700
changeset 9775 34625023efb80b600b5b2303be9cc92a6b72a5b4
parent 9766 573476da2cb5da56b655f8fbbb766d8ebe86c05b
child 9776 2c0367c51a095268a0b258ec011635ccafb28fb1
push id1324
push userbmo:gps@mozilla.com
push dateWed, 26 Oct 2016 19:21:50 +0000
reviewerskang
bugs1263973
hgmo: handle /boot unmount (bug 1263973); r?kang In production, there is a /boot/efi mount. So, skip /boot during the first pass so we don't try to unmount things with children. MozReview-Commit-ID: J4xRsxHp08r
testing/docker/builder-hgweb-chroot/mozbuild-eval.c
--- a/testing/docker/builder-hgweb-chroot/mozbuild-eval.c
+++ b/testing/docker/builder-hgweb-chroot/mozbuild-eval.c
@@ -102,16 +102,19 @@ static int call_mozbuildinfo(void* repo_
     if (!fmount) {
         fprintf(stderr, "unable to open /proc/mounts\n");
         return 1;
     }
 
     while ((mnt = getmntent(fmount))) {
         /* These can't be deleted during our first pass because there
          * are child mounts. */
+        if (strcmp(mnt->mnt_dir, "/boot") == 0) {
+            continue;
+        }
         if (strcmp(mnt->mnt_dir, "/dev") == 0) {
             continue;
         }
         if (strcmp(mnt->mnt_dir, "/proc") == 0) {
             continue;
         }
         /* We can't unmount /sys in first pass because cgroups are present. */
         if (strcmp(mnt->mnt_dir, "/sys") == 0) {
@@ -141,16 +144,21 @@ static int call_mozbuildinfo(void* repo_
             return 1;
         }
     }
 
     /* Always returns 1. */
     endmntent(fmount);
 
     /* Now unmount skips since children should be gone. */
+    if (umount2("/boot", 0)) {
+        fprintf(stderr, "unable to unmount /boot\n");
+        return 1;
+    }
+
     if (umount2("/dev", 0)) {
         fprintf(stderr, "unable to unmount /dev\n");
         return 1;
     }
 
     /* It is especially important that proc is unmounted because
      * historically there have been a lot of root privilege escalation
      * bugs in procfs. */