home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / programm / 4375 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  3.9 KB

  1. Path: sparky!uunet!auspex-gw!guy
  2. From: guy@Auspex.COM (Guy Harris)
  3. Newsgroups: comp.unix.programmer
  4. Subject: Re: Process & Signal Question
  5. Message-ID: <14153@auspex-gw.auspex.com>
  6. Date: 19 Aug 92 21:24:53 GMT
  7. References: <Bt5tp0.9JI@gumby.ocs.com> <shj.714240376@login.dkuug.dk> <1992Aug19.191008.19362@prl.dec.com>
  8. Sender: news@auspex-gw.auspex.com
  9. Organization: Auspex Systems, Santa Clara
  10. Lines: 65
  11. Nntp-Posting-Host: bootme.auspex.com
  12.  
  13. >> True. Well, mostly. This may be a bug in the NFS implementation
  14. >> we're using, but if the binary is opened via NFS, you can unlink
  15. >> the file locally on the machine where the file resides. Odd.
  16. >
  17. >It's not odd if you know something about the implementation of NFS.
  18. >The server knows nothing about which files are being executed remotely.
  19. >Executables are read from the server, which explains why NFS imported
  20. >executables must be readable by the invoker.  Should such an executable
  21. >be removed on the server the process executing it on the server will
  22. >_probably_ die, depending on the executable's magic no and its memory
  23. >state.
  24.  
  25. Except that he said you can unlink the file *locally*, in which case the
  26. *client* should know that the file is being executed locally, and should
  27. do the rename trick (the file is renamed to a special ".nfs*" name, or
  28. whatever, and "marked for deletion" so that when the last local process
  29. holding onto the file lets go of it, it's removed).
  30.  
  31. If, by "you can unlink the file locally", he meant "you can unlink it
  32. and it goes away on the server, so that the processes using it run the
  33. risk of choking and dying", that *is* a bug in the NFS implementation.
  34.  
  35. If, by "you can unlink the file locally", he meant "you can unlink it,
  36. but it's just renamed, and only removed when the last local process
  37. holding it lets go of it", that's not a bug in the NFS implementation,
  38. it's a *feature* of the UNIX implementation.
  39.  
  40. I.e., they probably picked up Berkeley's removal of the old V7 crock by
  41. which an attempt to remove the last link to a running shared-text
  42. executable fails and sets "errno" to ETXTBSY, rather than marking the
  43. file for deletion.
  44.  
  45. V7 did that because, at the time, it didn't have any decent file system
  46. checkers (it may have had "icheck" and "dcheck", but there's no way in
  47. hell I'd call them "decent"), and the Research folks wanted to avoid
  48. having files hanging around with no links to them, because if the system
  49. crashed, it was a pain to get rid of those files.
  50.  
  51. Of course, it doesn't prevent that from happening, as you could still
  52. open a file and unlink it while it's open....
  53.  
  54. For some unknown reason, when they finally got around to putting "fsck"
  55. in, they didn't nuke that no-unlinking-an-active-shared-text-image
  56. crock.  Berkeley, however, realized that it was a crock, and got rid of
  57. it; you could remove the last link to a running image, and it'd be
  58. marked for deletion when the last process stopped using it, just as
  59. happens with open files.
  60.  
  61. The SVID folk, unfortunately, confused that crock with a feature, and
  62. put it into the SVID.  However, it requires it only for systems that
  63. support "shared text"; at Sun, we figured we'd just say "our system
  64. doesn't support shared text, it supports read-only copy-on-write
  65. mappings", which is entirely true, and avoid having to put that crock
  66. back.  (You still get sharing, because pages not copied-on-write are
  67. shared, but you don't get screwed by not being unable to remove the last
  68. link to a running image.)  Hopefully, the SVR4 folk did the same
  69. thing....
  70.  
  71. (Do not confuse the aforementioned crock with ETXTBSY on an attempt to
  72. open an active shared-text image file for writing.  The latter can be
  73. defended - and might even be implementable in a reasonable fashion, at
  74. least for local files, in a way that generalizes to handle SunOS
  75. 4.x/SVR4-style shared libraries as well.  The former can only be
  76. defended if you have no decent file system salvager, and UNIX has had
  77. "fsck" since at least 1980 or so, and it's decent enough for that....)
  78.