Re: over writing a device file when module not loaded.

Drew Eckhardt (drew@poohsticks.org)
Wed, 26 Jul 1995 18:11:46 -0600


In message <Pine.LNX.3.91.950725150434.5318C-100000@athena>, robert@athena.rutg
ers.edu writes:
>The other night, i decided to do a backup to my tape device.
>I use a tape backup connected to the FDC. and thus i use the device
>driver ftape, which is a kernel module. I forgot to load ftape before
>starting the backup (kerneld will fix this oversight of mine :-).
>Anyway, the tape did nothing of course, but the harddrive seemed very
>busy considering nothing else was really happening on the system. I
>realised what i had done and stopped the backup. I noticed the filesystem
>had filled up quite a bit, so i had a look in /dev. There the file
>/dev/rft0 (my tape device) was several Mb in size. Without the ftape
>module in memory tar had over written /dev/rft0 and just wrote the tar
>file to the file /dev/rft0. I had to delete the file and mknod the
>device again. I think the kernel should realise that device files are
>still device files rather than normal files even if the module isn't
>in memory. Here is my rft0 device:
>
>crw-rw-rw- 1 root root 27, 0 Jul 23 21:15 /dev/rft0

The kernel did nothing wrong; if a device file existed, but no
driver was present in the kernel for that device, you'd get a
-1 return when you tried to open it with errno set to ENODEV.

If the scripts you use usually mknod the device, or you deleted it
some how, and it wasn't created, you'd get this result...