[ostree] prepare-root: Move /sysroot instead of unmounting it
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] prepare-root: Move /sysroot instead of unmounting it
- Date: Tue, 24 Feb 2015 20:14:46 +0000 (UTC)
commit ace982b51ca853fd8c9c4a624530f6d260c97651
Author: Colin Walters <walters verbum org>
Date: Thu Feb 12 21:01:23 2015 -0500
prepare-root: Move /sysroot instead of unmounting it
I originally thought this would fix a regression, but it turns out
this wasn't the bug. But pushing anyways as it's just cleaner.
https://bugzilla.gnome.org/show_bug.cgi?id=743891
src/switchroot/ostree-prepare-root.c | 19 ++++---------------
1 files changed, 4 insertions(+), 15 deletions(-)
---
diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c
index 193c3bb..f24409f 100644
--- a/src/switchroot/ostree-prepare-root.c
+++ b/src/switchroot/ostree-prepare-root.c
@@ -185,14 +185,6 @@ main(int argc, char *argv[])
exit (EXIT_FAILURE);
}
- /* Link to the physical root below the deployment root */
- snprintf (destpath, sizeof(destpath), "%s/sysroot", newroot);
- if (mount (root_mountpoint, destpath, NULL, MS_BIND, NULL) < 0)
- {
- perrorv ("Failed to bind mount %s to '%s'", root_mountpoint, destpath);
- exit (EXIT_FAILURE);
- }
-
/* Link to the deployment's /var */
snprintf (srcpath, sizeof(srcpath), "%s/../../var", deploy_path);
snprintf (destpath, sizeof(destpath), "%s/var", newroot);
@@ -220,14 +212,11 @@ main(int argc, char *argv[])
touch_run_ostree ();
- /* Unmount the previous /sysroot now. Otherwise, we would be
- * placing our newroot mount on top of an existing mount, and after
- * we do a switch_root, we would no longer be able to ever unmount
- * the original mount.
- */
- if (umount (root_mountpoint) < 0)
+ /* Move physical root to $deployment/sysroot */
+ snprintf (destpath, sizeof(destpath), "%s/sysroot", newroot);
+ if (mount (root_mountpoint, destpath, NULL, MS_MOVE, NULL) < 0)
{
- perrorv ("failed to umount original mount at %s", root_mountpoint);
+ perrorv ("Failed to MS_MOVE %s to '%s'", root_mountpoint, destpath);
exit (EXIT_FAILURE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]