Re: apm bug?

From: Derrick Steed (derrick@m-steed.freeserve.co.uk)
Date: Tue Feb 08 2000 - 03:41:36 EST


Hi Amos,

1. I cannot answer immediately.

2. I think this is standard unix behaviour, it is certainly possible in
DG/UX to delete a file when another process is accessing it, and it will do
it without a wimper.

Now, if you're a granny expert at sucking eggs, then I apologise for what
follows, not to say I'm a granny (I'm not even a grandad):

What is happening? The file as you see it is an entry in a directory, but
that is not the file - it is merely a name/inode pointer pair. The inode
pointer is the "link" to the files inode (the inode contains all the
information about the file aside from the name: size, where it's located on
disk, access time...).

When a process makes a call to "open" the file it gets a link (just like the
"link" in the directory) to the inode (this is a bit woolly, but basically
true, I think). The inode has a reference count field which tallies the
number of links to it.

When is the file deleted? when the reference count goes to zero!

So you did not delete the file, you only removed the link from the directory
to the inode. However, when the process closes the file, to all intents and
purposes you have lost access to it (unless of course you can reconstruct
the inode pointer).

Question to the disk driver developers: Am I right? Does closing the files
remove the link and thus decrement the reference count? What happens to the
space mapped by the inode?

Rgds,

Derrick.
----- Original Message -----
From: amos <amos@surfree.net.il>
To: Derrick Steed <derrick@m-steed.freeserve.co.uk>
Sent: Tuesday, February 08, 2000 2:58 AM
Subject: Re: apm bug?

> On Sat, 05 Feb 2000, you wrote:
> > There is a patch http://linuxcare.com.au/apm/)
> > May be wrong, but hope it helps anyway.
> Thanks, it helped alot.
>
> Therefore, you have been chosen (...) to answer some other questions I
have
> (hope you don't mind) :
> 1. (this arised while trying to install the patched linux kernel -
> the computer got stuck saying no coprocessor found and no math
> emulation, giving up. Apparently the no_hlt and no387 in lilo.conf I
put
> there in order to try and see if it has something to do with APM
shutdown
> (in the unpatched kernels) caused it to hang. Running lilo from almost
all
> bootdisks I have didn't help, it said something about missing LILO
signature
> in the boot sector, which wasn't true - I guess lilo v0.19 and 0.20
has some
> bugs), so the question is how do I mount my HD after running
boot/rescue
> disks so I can execute things from there - mounting it works fine but
trying
> to execute ANYTHING from there fails, even after adding the binary
directory
> to PATH, or copying the wanted file to the boot disks filesystem.
> Chmod/chown doesn't help either. The shell either prompts me that 'no
such
> command' (even though it exists).
> This is weird because neither the bootdisk filesystem nor the HD was
> mounted as read only or noexec.
> btw : I've finally found a boot disk with lilo 0.21, and the new
kernel
> works fine (after removing the no386 and nohlt). APM now works.
>
> 2. In general - It seems that I can delete files that
> are accessed in other processes at the same time. Is there an
option/util
> that will warn me before doing so?
>
> More questions might follow...
> Thanks,
> Amos
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:12 EST