From: Malcolm Beattie (mbeattie@black.ox.ac.uk)
Date: 06/23/93


From: mbeattie@black.ox.ac.uk (Malcolm Beattie)
Subject: Re: file corruption in ext2fs
Date: Wed, 23 Jun 1993 09:46:53 GMT

In article <1993Jun22.235251.12558@coplex.coplex.com> dean@coplex.coplex.com (Dean Brooks) writes:
>torvalds@klaava.Helsinki.FI (Linus Torvalds) writes:
>
>>This is not a bug, nor even real "fs corruption" but normal unix
>>filesystem semantics.. What happens is that when you remove the
>>/etc/init binary, it doesn't actually get deleted from the disk until
>>it's no longer used by any program. In the case init, this obviously
>>never happens - the binary will be busy all the time. So when you shut
>>the machine down, the old init binary still exists on the disk, but no
>>directory entry points to it. The appropriate 'fsck' will take care of
>>it.
>
>Wouldn't it possibly be appropriate to have the unlink() function
>return an error on a currently running executable? On our
>SysV3.2 system, we get an "error: text file busy" error and prevents
>the missing inode the original poster wrote about.

Yuck. That would be very ugly, although POSIX does say that
an implementation can do this if it wants. There are many
programs on the machine I run that are in constant use by
at least one of the ~1000 users. I want to be able to do

# rm /usr/local/bin/foo; mv newfoo /usr/local/bin/foo

rather than (try to) arrange for everyone to stop using xterm
or elm or whatever at the same time.
The current Linux behaviour is correct and, as Linus says,
you only run into a problem with an init process running
a demand paged executable.

--Malcolm

-- 
Malcolm Beattie <mbeattie@black.ox.ac.uk> | I'm not a kernel hacker
Oxford University Computing Services      | I'm a kernel hacker's mate
13 Banbury Road, Oxford, OX2 6NN (U.K.)   | And I'm only hacking kernels
Tel: +44 865 273232 Fax: +44 865 273275   | 'Cos the kernel hacker's late