Hi Sorry for the confusion caused. I just realized that I was using fread and not read. By "shred", I meant the /usr/bin/shred program which overwrites a file with junk. I was getting stale result because of the buffering at fread. Thanks again for the responses. On Jan 4, 2008 2:15 AM, David Schwartz <davids@xxxxxxxxxxxxx> wrote: > > > This is what I understand now, if I delete the file, the kernel > > guarantees that the file data is preserved till the last reference (in > > the form of an open filehandle maybe) lingers. If I shred the file, > > the read succeeds till the buffering is done. > > Actually, you can't delete a file while there are references to it. You can > remove it from its directory, which reduces the reference count by one, but > that's it. That's why the system call in UNIX is called "unlink" rather than > "delete". > > A file is automatically deleted when its reference count goes to zero. > Putting a file in a directory adds one to its reference count. Opening a > file adds one. > > > This, however sounds wierd to me, what we are essentially saying is > > that the open/read might not return the latest data!!!! AFAIK the > > buffer cache/inode cache that the kernel maintains is refreshed as > > soon the file is modified. Please clarify. > > It's impossible to clarify unless you tell us more precisely what you are > doing. For example, you use the term "shred", but that can mean way more > than one thing. Also, when you talk about "reading" a file, that could mean > the "read" system call, but it could also mean the "fread" library function. > > DS > > > -- Keep Running.... And Relish the run... +Fasih _______________________________________________ Ext3-users mailing list Ext3-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/ext3-users