Re: switch_root: zap the last directory for the mount point of new-root

2019-08-10 Thread 阿保 純一
On Fri, 2 Aug 2019 22:40:01 +0800 Kang-Che Sung wrote: > What I suggested is to remove these lines: > > if (st.st_dev == rootdev) { > // Show usage, it says new root must be a mountpoint > bb_show_usage(); > } > > Because mount(..., MS_MOVE) will do the same check before moving the mount >

Re: switch_root: zap the last directory for the mount point of new-root

2019-08-02 Thread Kang-Che Sung
On Friday, August 2, 2019, 阿保 純一 wrote: >> Speaking of, since we are now overmounting the root before zapping the >> initramfs, I wonder if we can remove one check about whether the new root >> is a mount point (this saves code size; mount() would fail with EINVAL in >> that case). > At least, I

Re: switch_root: zap the last directory for the mount point of new-root

2019-07-19 Thread Kang-Che Sung
On Friday, July 19, 2019, Kang-Che Sung wrote: > > There's side benefit for this patch: In case that overmount fails, we can have > a rootfs kept intact (instead of almost destroyed). > Correction. It's just a side effect, not a "benefit" worth talking about. Speaking of, since we are now

Re: switch_root: zap the last directory for the mount point of new-root

2019-07-19 Thread Kang-Che Sung
On Fri, Jul 19, 2019 at 3:27 PM 阿保 純一 wrote: > > As the author said in the comment of util-linux/switch_root.c, current > implementation leaves the mount point of new root-file-system without rmdir(). > As long as I experimented on a linux kernel, current process of "/" still > points old

switch_root: zap the last directory for the mount point of new-root

2019-07-19 Thread 阿保 純一
As the author said in the comment of util-linux/switch_root.c, current implementation leaves the mount point of new root-file-system without rmdir(). As long as I experimented on a linux kernel, current process of "/" still points old root-file-system even "/" is overmounted. So we can still