Another posix file system question
Bill Freeman
ke1g.nh at gmail.com
Tue Feb 26 15:09:43 EST 2013
Scenario,
Apache or nginx is serving a file, in response to an AJAX request, because
serving static files is fast. The file contains data to be displayed on a
web page (via jQueryUI bar graphs, among, if that's of interest).
While I might come up with a scheme for updating file contents in place
(open for writing,don't truncate, seek, write), I would feel less as hazard
if I wrote a new file and swapped it in under the the same directory entry.
(Hopefully, if the server tends to cache static files in memory, it at
least does a stat on the file name at each request, to see if the
modification time has changed.)
The plan is to create a new file under a different name, then hard link the
critical name to the new file.
I know that I can use 'ln -f' on the command line, but I don't know whether
that turns into an unlink followed by a link, leaving a tiny window during
which the critical name doesn't exist, or whether (other than updating link
counts) this just does the equivalent of writing a new inode number into
the directory entry.
Anybody who has actually looked at the code this millennium (Ric) want to
give an opinion?
Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20130226/30e29597/attachment.html
More information about the gnhlug-discuss
mailing list