summaryrefslogtreecommitdiff
path: root/src/core/switch-root.c
AgeCommit message (Collapse)Author
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
2012-11-16switch-root: try pivot_root() before overmounting /Lennart Poettering
We should always try to umount the old root dir if possible, instead of overmounting it -- if that's possible. The initial ("first") kernel rootfs can never be umounted, hence for the usual nitrd case we never bothered using pivot_root() and hence with fully unmounting it. However, fedup now tranisitions twice during boot, and in that case it is highly desirable that the "second" root dir is entirely unmounted when we switch to the "third". This patch makes that possible. The pivot_root() needs a directory in the "third" root dir, to move the "second" root dir to. We use /mnt for that, under the assumption that this directory is likely to exist, and is not itself a mount point.
2012-08-13namespace: rework namespace supportLennart Poettering
- don't use pivot_root() anymore, just reuse root hierarchy - first create all mounts, then mark them read-only so that we get the right behaviour when people want writable mounts inside of read-only mounts - don't pass invalid combinations of MS_ constants to the kernel
2012-08-12switch-root: remount to MS_PRIVATELennart Poettering
The kernel does not allow switching roots if things are mounted MS_SHARED. As a work-around, remount things MS_PRIVATE before switching roots. This should be fixed in the kernel for good. https://bugzilla.redhat.com/show_bug.cgi?id=847418
2012-05-22switch-root: do not use close old_root_fd after rm_rf_children()Harald Hoyer
rm_rf_children() has already closed the fd with closedir().
2012-05-21switch-root: move switch_root() call into its own .c fileLennart Poettering