Ticket #981: systemd-213-separate_usr-1.patch

File systemd-213-separate_usr-1.patch, 6.3 KB (added by William Harrington, 11 years ago)
  • src/core/main.c

    diff -Naur systemd-213.orig/src/core/main.c systemd-213/src/core/main.c
    old new  
    11701170                    "Please make sure to replace this file by a symlink to avoid incorrect or misleading mount(8) output.");
    11711171}
    11721172
    1173 static void test_usr(void) {
    1174 
    1175         /* Check that /usr is not a separate fs */
    1176 
    1177         if (dir_is_empty("/usr") <= 0)
    1178                 return;
    1179 
    1180         log_warning("/usr appears to be on its own filesytem and is not already mounted. This is not a supported setup. "
    1181                     "Some things will probably break (sometimes even silently) in mysterious ways. "
    1182                     "Consult http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken for more information.");
    1183 }
    1184 
    11851173static int initialize_join_controllers(void) {
    11861174        /* By default, mount "cpu" + "cpuacct" together, and "net_cls"
    11871175         * + "net_prio". We'd like to add "cpuset" to the mix, but
     
    15681556                loopback_setup();
    15691557
    15701558                test_mtab();
    1571                 test_usr();
    15721559        }
    15731560
    15741561        if (arg_running_as == SYSTEMD_SYSTEM && arg_runtime_watchdog > 0)
  • src/core/manager.c

    diff -Naur systemd-213.orig/src/core/manager.c systemd-213/src/core/manager.c
    old new  
    501501         * here. We do that after deserialization, since they might
    502502         * have gotten serialized across the reexec. */
    503503
    504         m->taint_usr = dir_is_empty("/usr") > 0;
    505 
    506504        *_m = m;
    507505        return 0;
    508506
     
    22112209                        else
    22122210                                m->n_failed_jobs += n;
    22132211
    2214                 } else if (startswith(l, "taint-usr=")) {
    2215                         int b;
    2216 
    2217                         b = parse_boolean(l+10);
    2218                         if (b < 0)
    2219                                 log_debug("Failed to parse taint /usr flag %s", l+10);
    2220                         else
    2221                                 m->taint_usr = m->taint_usr || b;
    2222 
    22232212                } else if (startswith(l, "firmware-timestamp="))
    22242213                        dual_timestamp_deserialize(l+19, &m->firmware_timestamp);
    22252214                else if (startswith(l, "loader-timestamp="))
  • src/core/mount.c

    diff -Naur systemd-213.orig/src/core/mount.c systemd-213/src/core/mount.c
    old new  
    353353static bool should_umount(Mount *m) {
    354354        MountParameters *p;
    355355
    356         if (path_equal(m->where, "/") ||
    357             path_equal(m->where, "/usr"))
     356        if (path_equal(m->where, "/"))
    358357                return false;
    359358
    360359        p = get_mount_parameters(m);
  • src/core/umount.c

    diff -Naur systemd-213.orig/src/core/umount.c systemd-213/src/core/umount.c
    old new  
    386386                         * them.
    387387                         *
    388388                         * Mount points can be stacked. If a mount
    389                          * point is stacked below / or /usr, we
     389                         * point is stacked below /, we
    390390                         * cannot umount or remount it directly,
    391391                         * since there is no way to refer to the
    392392                         * underlying mount. There's nothing we can do
     
    400400                        mount(NULL, m->path, NULL, MS_REMOUNT|MS_RDONLY, NULL);
    401401                }
    402402
    403                 /* Skip / and /usr since we cannot unmount that
    404                  * anyway, since we are running from it. They have
     403                /* Skip / since we cannot unmount that
     404                 * anyway, since we are running from it. It has
    405405                 * already been remounted ro. */
    406                 if (path_equal(m->path, "/")
    407 #ifndef HAVE_SPLIT_USR
    408                     || path_equal(m->path, "/usr")
    409 #endif
    410                 )
     406                if (path_equal(m->path, "/"))
    411407                        continue;
    412408
    413409                /* Trying to umount. We don't force here since we rely
  • src/fstab-generator/fstab-generator.c

    diff -Naur systemd-213.orig/src/fstab-generator/fstab-generator.c systemd-213/src/fstab-generator/fstab-generator.c
    old new  
    151151                fstype_is_network(me->mnt_type);
    152152}
    153153
    154 static bool mount_in_initrd(struct mntent *me) {
    155         assert(me);
    156 
    157         return
    158                 hasmntopt(me, "x-initrd.mount") ||
    159                 streq(me->mnt_dir, "/usr");
    160 }
    161 
    162154static int add_mount(
    163155                const char *what,
    164156                const char *where,
     
    340332                _cleanup_free_ char *where = NULL, *what = NULL;
    341333                int k;
    342334
    343                 if (initrd && !mount_in_initrd(me))
     335                if (initrd)
    344336                        continue;
    345337
    346338                what = fstab_node_to_udev_node(me->mnt_fsname);
     
    375367
    376368                        if (initrd)
    377369                                post = SPECIAL_INITRD_FS_TARGET;
    378                         else if (mount_in_initrd(me))
    379                                 post = SPECIAL_INITRD_ROOT_FS_TARGET;
    380370                        else if (mount_is_network(me))
    381371                                post = SPECIAL_REMOTE_FS_TARGET;
    382372                        else
  • src/remount-fs/remount-fs.c

    diff -Naur systemd-213.orig/src/remount-fs/remount-fs.c systemd-213/src/remount-fs/remount-fs.c
    old new  
    7777                int k;
    7878                char *s;
    7979
    80                 /* Remount the root fs, /usr and all API VFS */
     80                /* Remount the root fs and all API VFS */
    8181                if (!mount_point_is_api(me->mnt_dir) &&
    82                     !path_equal(me->mnt_dir, "/") &&
    83                     !path_equal(me->mnt_dir, "/usr"))
     82                    !path_equal(me->mnt_dir, "/"))
    8483                        continue;
    8584
    8685                log_debug("Remounting %s", me->mnt_dir);