Mellvik / TLVC

Tiny Linux for Vintage Computers
Other
7 stars 0 forks source link

/bin/sh lingering mount problem #59

Open Mellvik opened 2 months ago

Mellvik commented 2 months ago

If a shell is started from a (sub)mounted filesystem, then exited, that fs can no longer be unmounted (boot required).

TLVC 0.6.0

login: root
tlvc17# mount /dev/dhda2 /mnt
MINIX: inodes 21845 imap 3 zmap 8, first data 696
MINIX-fs: mounting unchecked file system 0x502, running fsck is recommended.
tlvc17# umount /mnt
tlvc17# fsck -a /dev/rdhda2
Filesystem on /dev/rdhda2 is dirty, needs checking.
tlvc17# fsck -a /dev/rdhda1
Filesystem on /dev/rdhda1 is dirty, needs checking.
tlvc17# !mo
mount /dev/dhda2 /mnt
MINIX: inodes 21845 imap 3 zmap 8, first data 696
tlvc17# /mnt/bin/sh
# df
Filesystem    1K-blocks     Free     Used    %  FUsed%  Mounted on
/dev/dhda3        65535    62984     2551   4%     1%   /
/dev/dhda2        65535    63707     1828   3%     1%   /mnt
# ^D
tlvc17# !um
umount /mnt
/mnt: Device or resource busy                         <----- cannot unmount even if process is gone
tlvc17# mount /dev/dhda1 /mnt2                   <--- mounting a different fs this time
MINIX: inodes 21845 imap 3 zmap 8, first data 696
tlvc17# /mnt2/bin/sash                                  <----- try sash
# ls /mnt2
.
..
386.linux
bin
bootopts
bootopts.386
dev
etc
good.linux
linux
mnt
root
tmp
# ^D
tlvc17# umount /mnt2                               <----- no problem unmounting
tlvc17# mount /dev/dhda4 /mnt2            <----- mounting FAT fs
FAT: me=f8,csz=16,#f=2,floc=1,fsz=147,rloc=295,#d=512,dloc=327,#s=601776,ts=601776
FAT: total 300M, fat16 format
tlvc17# /mnt2/bin/sh
/mnt2/bin/sh: not found
tlvc17# cp /bin/sh /mnt2/bin/
tlvc17# sync
tlvc17# /mnt2/bin/sh
# pwd
/root
# ^D
tlvc17# umount /mnt2
/mnt2: Device or resource busy                  <----- again, umount is blocked
tlvc17# df
Filesystem    1K-blocks     Free     Used    %  FUsed%  Mounted on
/dev/dhda3        65535    62984     2551   4%     1%   /
/dev/dhda2        65535    63707     1828   3%     1%   /mnt
/dev/dhda4       300883   295112     5771   2%          /mnt2 (FAT)
tlvc17# ps
  PID   GRP  TTY USER STAT CPU  HEAP  FREE   SIZE COMMAND
    1     0      root    S   0  3072  2014  12944 /bin/init 3 
   12    12    1 root    S   0  1188 13330  71280 -/bin/sh 
   13    13   S0 root    S   0  2280 12316  71280 -/bin/sh 
   14    14   S2 root    S   0     0  1976   8512 /bin/getty /dev/ttyS2 57600 
   42    13   S0 root    R   0  1024  1176  11680 ps 
    6     6      root    S   0  1024 34738  75824 ktcp -b -p ne0 10.0.2.17 10.0.2.2 255.255.255.0 
    8     8      root    S   0     0  1998   9744 telnetd 
   10     2   S0 root    S   0     0  7306  28672 ftpd -d 
tlvc17# umount /mnt
/mnt: Device or resource busy 
tlvc17# umount /mnt2
/mnt2: Device or resource busy 
tlvc17#