Looks like devfs handles changes in device ownership just fine. As long as you
are not doing anyting apart of changin ownership, that is. No driver unloading,
no user process exiting... Here are two samples:
-- cut --
# ls -al /dev/ide/host0/bus1/target0/lun0/cd
brw-rw-rw- 1 root root 22, 0 Jan 1 1970
/dev/ide/host0/bus1/target0/lun0/cd
# chown khim.khim /dev/ide/host0/bus1/target0/lun0/cd
# ls -al /dev/ide/host0/bus1/target0/lun0/cd
brw-rw-rw- 1 khim khim 22, 0 Jan 1 1970
/dev/ide/host0/bus1/target0/lun0/cd
# rmmod ide-cd
# ls -al /dev/ide/host0/bus1/target0/lun0/cd
brw-rw-rw- 1 khim khim 22, 0 Jan 1 1970
/dev/ide/host0/bus1/target0/lun0/cd
# lsmod | grep ide-cd
# rm -f /dev/ide/host0/bus1/target0/lun0/cd
# ls -al /dev/ide/host0/bus1/target0/lun0/cd
ls: /dev/ide/host0/bus1/target0/lun0/cd: No such file or directory
# modprobe ide-cd
hdc: ATAPI 40X CD-ROM drive, 120kB Cache
devfs: devfs_auto_unregister(): only one slave allowed
master: "cd" old slave: "cdrom0" new slave: "cdrom1"
Forcing Oops
<oops skipped - I can easily reproduce it if needed :)>
# ls -al /dev/ide/host0/bus1/target0/lun0/cd
brw-rw-rw- 1 khim khim 22, 0 Jan 1 1970
/dev/ide/host0/bus1/target0/lun0/cd
# rmmod ide-cd
ide-cd: Device or resource busy
-- cut --
Annoying but not disaster - I still can use my CD-ROM even if I can not unload
ide-cd.
-- cut --
$ su -c "xterm&"
Password:
<in xterm window>
# ls -l /dev/pts
total 0
crw--w---- 1 root tty 136, 0 May 23 06:02 0
<so far so good, exiting from xterm>
$ ls -l /dev/pts
total 0
<still good>
$ mc
open (pty_name, O_RDWR): Permission denied
couldn't open slave side of pty (/dev/pts/0)
<hmm... something strange goes on>
$ ls -l /dev/pts
crw--w---- 1 root tty 136, 2 May 23 06:02 2
<oops... HOW ? Why it's root.tty's one, not my one ?>
-- cut --
This is total disaster :-( If root in system using openpty()-based program then
suddenly for other users mc, xterm and so on are work only if moon is in right
phase...
P.S. It's with kernel 2.2.15pre9 and devfs 99.11 but I've not seen any
relevant patches in later versions :-/
|