[Info-vax] Current VMS engineering quality, was: Re: What's VMS up to these

Johnny Billquist bqt at softjar.se
Thu Mar 15 19:08:35 EDT 2012


On 2012-03-15 15.34, glen herrmannsfeldt wrote:
> Johnny Billquist<bqt at softjar.se>  wrote:
>
> (snip regarding NFS mounts of disks that go away.)
>
>>> In general, Unix doesn't do much file locking, and, yes the NFS
>>> implementation is especially troublesome.
>
>> Indeed. But it is worse. For example, if a file is opened for execution,
>> Unix prevents you from writing to that file.
>
> Not on systems that I used. Which ones do that?

Linux and NetBSD at least. Can't remember if I've tried on others...

Example run, with a local copy of sleep (on a Linux system):

gazonk:/tmp> ./foo 1m &
[2] 19490
gazonk:/tmp> cat > foo
foo: Text file busy.
gazonk:/tmp>

Exactly the same results with NetBSD.

The error code is ETXTBSY

To quote the man-page:
      26 ETXTBSY Text file busy.  The new process was a pure procedure 
(shared
              text) file which was open for writing by another process, or
              while the pure procedure file was being executed an 
open(2) call
              requested write access.

>> This semantic is also lost if the file is accessed over NFS,
>> meaning you can write to a binary that is being executed,
>> causing the memory of that executable to randomly
>> corrupted at execution time, depending on when/if page in
>> from the binary happens.
>
> That does happen.

Indeed. Unix networking just working without problems... Yeah right...

>>> I am not sure exactly how much has to change. If something relating
>>> to the specific disk changes, then yes.
>
>> No. It's basically if anything appears different in the hardware
>> configuration. Enumeration of devices are a part of NFS, and if that
>> enumeration is suspected to have changed, then all old file handles
>> are invalidated. Note that it does not necessarily have to have
>> changed, it's just the suspicion that it has changed that is
>> enough to trigger this.
>
> It is likely different on different systems. I am pretty sure
> that I did some changes where they didn't go stale, and others
> where they did.

It most probably is. After all, the basic problem is that the server 
must know that file handles are still valid in order to accept them. If 
it can be clever about it, it can be more forgiving. So it all depends 
on the server. There are no guarantees on how this works. Every 
implementation does its own thing.

	Johnny



More information about the Info-vax mailing list