Yang Xiaopeng writes:
>I'm sure that no user process use old root now, but when run "umount >/old_root", it says: > umount: /old_root: Device or resource busy > >I have tried to remount /proc within the new root *after* chroot, but >get the same result. > > I found the problem, I said that no user process use old root when run my scripts, but I'm wrong, actually there is a '3' fd open the file "/old_root/dev/console". By adding debug message in init/init.c, I found the problem: when init restart(in exec_signal()), before open the new terminal device, there is still a file opened(I don't know which file it is), so the terminal device(stdin) get fd '1', and the first dup(0)(stdout) return '2', the second(stderr) return '3'. I attach a simple patch to solve this problem.
This commit is contained in:
parent
930c59675a
commit
9cdef5d928
@ -735,6 +735,11 @@ static void exec_signal(int sig)
|
||||
sigaddset(&unblock_signals, SIGTSTP);
|
||||
sigprocmask(SIG_UNBLOCK, &unblock_signals, NULL);
|
||||
|
||||
/* Close whatever files are open. */
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
|
||||
/* Open the new terminal device */
|
||||
if ((device_open(a->terminal, O_RDWR)) < 0) {
|
||||
if (stat(a->terminal, &sb) != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user