Re: "Text file busy"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 15, 2003 at 05:52:59PM +0200, Guennadi Liakhovetski wrote:
> So, can anybody explain, what's the logic behind the behaviour - one can't
> overwrite an existing running file, but can remove it? Is overwriting
> re-uses the inode? And what's the result of that discussion about
> overwriting shared libraries while they are in use?...

The inodes (and underlying files) are reference counted on users. So
removing the file doesn't quite accurately describe what happens.
Instead, you are just removing the link between a specific filename and
the file. When all are gone, and all processes with the file open
close() the file (or exit()), _THEN_ the kernel removes the file.

Overwriting the contents of files while executing them is nasty. What
happens, if a page fault happens for a text page while another process is
replacing those pages on disk? Inconsistent memory mapped executables...
(Note that this is actually what happens when executables are loaded
over NFS when the lockdaemon isn't running! It provides an easy way to
test these failures, though. :)

> And, actually, why these questions arose - does anybody by chance have any
> pointers to standard ways of updating running systems? For example, is
> there somewhere a description of how Debian handles installation updates?
> They seem to manage it pretty well...

Not so hard. Unlink the old one. Put in the new one. When the program is
restarted, it then uses the new executable image and the old one goes
away. The same happens with libraries or executables.

-- 
United States of America, n: The finest plutocracy on the planet!

Attachment: pgp00368.pgp
Description: PGP signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux