public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* rm-ing files with open file descriptors
@ 2002-01-18 21:11 Doug Alcorn
  2002-01-18 21:27 ` Xavier Bestel
                   ` (4 more replies)
  0 siblings, 5 replies; 44+ messages in thread
From: Doug Alcorn @ 2002-01-18 21:11 UTC (permalink / raw)
  To: linux-kernel


I had a weird situation with my application where the user deleted all
the database files while the app was still reading and writing to the
opened file descriptor.  What was weird to me was that the app didn't
complain.  It just went merrily about it's business as if nothing were
wrong.  Of course, after the app shut down all it's data was lost.

Since I didn't expect this behavior I wrote a simple little program to
test it[1].  Sure enough, you can rm a file that has opened file
descriptors and no errors are generated.  Interestingly, sun solaris
does the same thing.  Since this is the case, I thought this might be
a feature instead of a bug (ms-win doesn't allow the rm).  So, my
question is where is this behavior defined?  Is it a kernel issue?
Does POSIX define this behavior?  Is it a libc issue?  

I tried to google this, but couldn't think of the right terms to
describe it.  As I'm not on lkm, I would appreciate a CC: to
<doug@lathi.net>.
-- 
 (__) Doug Alcorn (mailto:doug@lathi.net http://www.lathi.net)
 oo / PGP 02B3 1E26 BCF2 9AAF 93F1  61D7 450C B264 3E63 D543
 |_/  If you're a capitalist and you have the best goods and they're
      free, you don't have to proselytize, you just have to wait. 


^ permalink raw reply	[flat|nested] 44+ messages in thread
* Re: rm-ing files with open file descriptors
@ 2002-01-18 22:11 Hank Leininger
  0 siblings, 0 replies; 44+ messages in thread
From: Hank Leininger @ 2002-01-18 22:11 UTC (permalink / raw)
  To: linux-kernel

On 2002-01-18, Ken Brownfield <brownfld@irridia.com> wrote:

> One nasty side-effect is space allocation -- after unlinking a file and
> writing to it, you can fill the disk without the file showing up in
> 'ls' or 'du', etc.  Hard to debug.  Stronghold on Solaris used to do
> this with log files -- HUP did not discard the old FDs.

Hell, syslogd on Linux used to do that ;)

Linux's /proc/PID/fd/* will (nowadays) tell you the path/name of files that
have been unlinked but have active file descriptors, which at least makes
this less painful to track down *once you think of it*.

--
Hank Leininger <hlein@progressive-comp.com> 
  

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2002-01-24  9:47 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-18 21:11 rm-ing files with open file descriptors Doug Alcorn
2002-01-18 21:27 ` Xavier Bestel
2002-01-18 21:28 ` Ken Brownfield
2002-01-19 20:23   ` Rob Landley
2002-01-18 21:49 ` Richard B. Johnson
2002-01-19  0:50   ` Miquel van Smoorenburg
2002-01-19  2:29     ` H. Peter Anvin
2002-01-19 10:57       ` Xavier Bestel
2002-01-19 11:10       ` Miquel van Smoorenburg
2002-01-19 11:28         ` Alexander Viro
2002-01-19 12:01           ` Miquel van Smoorenburg
2002-01-23 12:18             ` Pavel Machek
2002-01-24  9:46               ` Herbert Xu
2002-01-19 17:44           ` Kai Henningsen
2002-01-20 15:30             ` Richard Kettlewell
2002-01-20 18:21               ` Doug McNaught
2002-01-20 23:10               ` Miquel van Smoorenburg
2002-01-20  3:55           ` Chris Wedgwood
2002-01-19 15:21         ` Horst von Brand
2002-01-19 15:32           ` Mr. James W. Laferriere
2002-01-19 20:26             ` Rob Landley
2002-01-19 17:53           ` Miquel van Smoorenburg
2002-01-20 15:48             ` Horst von Brand
2002-01-19 20:24           ` Rob Landley
2002-01-19 11:15       ` Ville Herva
2002-01-19 12:16       ` Matthias Schniedermeyer
2002-01-19 12:22         ` Xavier Bestel
2002-01-19 12:29           ` Alexander Viro
2002-01-19 12:46             ` Xavier Bestel
2002-01-19 13:18               ` Rogier Wolff
2002-01-19 15:24             ` Horst von Brand
2002-01-19 14:50     ` Horst von Brand
2002-01-20 14:23     ` Remi Turk
2002-01-20 20:02       ` Ville Herva
2002-01-20 20:44         ` Andreas Ferber
2002-01-20 21:08           ` Ville Herva
2002-01-21  9:06             ` Horst von Brand
2002-01-21  9:21               ` Ville Herva
2002-01-18 21:59 ` J Sloan
2002-01-19  4:18 ` Andreas Bombe
2002-01-19 14:51   ` christophe barbé
2002-01-19 18:01     ` Kai Henningsen
2002-01-20  3:43       ` christophe barbé
  -- strict thread matches above, loose matches on Subject: below --
2002-01-18 22:11 Hank Leininger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox