Re: The kernel (file system) in Debian supports replacing files even while they're being used.
On Wed, 2003-01-01 at 17:37, Ron Johnson wrote:
> On Wed, 2003-01-01 at 15:50, Frank Gevaerts wrote:
> > On Wed, Jan 01, 2003 at 02:45:22PM -0600, Ron Johnson wrote:
> > >
> > > Shaul knows that *that* works. He wants to know how dpkg can
> > > update active/open files, while he can't...
> > It can't, but it doesn't need to. An upgrade is a sequence of remove and
> > install, while leaving the configuration intact. The remove step is
> > equivalent to the 'rm mysleep' step above.
> But then what happens when one of these loaded binaries calls a
> function in a library that has been replaced?
A reference count is associated with each file opened by any process.
A binary which loads a library increments the reference count of said
library. If the library is deleted, as long as one process is have
the library open, the kernel will not physically free up the inodes
making up that library until the reference count for that library
drops to zero. This way, running binaries still have access to the
The same thing also happens with the binaries themselves.
> Or, say, a loaded binary goes to re-read a data file who's lay-
> out happens to have changed between versions?
Depends on how the running binary is coded. In the usual case
where the data file is opened, read, and then closed, then whether
the running binary will choke or not depends on whether its parsing
routine and data file format is forward-compatible.
If not, then it's up to Debian policy to say that when appropriate,
running binaries must be restarted on upgrades.
Steven Yap <email@example.com>