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

Re: Why mount -o remount,ro /usr (sometimes) fails after apt-get dist-upgrade?



On Mon, Nov 11, 2002 at 09:57:16AM -0500, sean finney wrote:
> On Mon, Nov 11, 2002 at 11:56:02AM +0200, Shaul Karl wrote:
> >   Basically, when one removes a binary file from a UNIX file system, it 
> > is gone - no matter if this binary is currently in use. Therefore, 
> 
> i don't think that's necessarily true.  i believe the way it works is
> that a file is not 'gone' (in the sense of fs de-allocation) until there
> are no more references to it.  so for example, i think if you open a
> file for reading, and then immediately remove the file, you should still
> be able to read the entire file, even if it's over a page in size.
> you could verify this with a simple c-program or perl script where you
> open the file, then rm it via system(), and then read the data.
> 
> now i could be wrong (and feel free to correct me if i am), but i think
> executing the file also counts as a reference to it in some way, so when
> you delete the file and/or overwrite it with an upgrade, if the program
> is running in memory it should be just fine and should be able to load in
> pages that weren't already in memory, but as soon as it exits the file
> is 'gone'.  in the meantime that the program is running, subsequent
> calls to exec/read that file will get the new file (or fail if it was
> simply removed).  

You are correct. This is how it's possible for distributions like Debian
to upgrade running programs.

  http://www.debian.org/doc/FAQ/ch-pkgtools.en.html#s-updaterunning
  (although it doesn't go into much detail ...)

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: