Can the O_TMPFILE later be saved with real name ?
Can the O_TMPFILE later be saved with real name ?
Posted Jul 22, 2013 14:38 UTC (Mon) by ernest (guest, #2355)Parent article: Kernel prepatch 3.11-rc2
Note that I was just curious. I realize that a create of the final file followed by a data copy would certainly fit the purpose, furthermore the old tmp file name mechanisms still works if I needed this.
Posted Jul 22, 2013 14:46 UTC (Mon)
by josh (subscriber, #17465)
[Link] (1 responses)
Posted Jul 22, 2013 15:08 UTC (Mon)
by andresfreund (subscriber, #69562)
[Link]
Posted Jul 22, 2013 15:07 UTC (Mon)
by sbohrer (guest, #61058)
[Link] (3 responses)
Posted Jul 22, 2013 16:08 UTC (Mon)
by lambda (subscriber, #40735)
[Link] (2 responses)
One of the big use cases for an O_TMPFILE feature would be to improve the pattern of creating a temporary file and renaming it over the original file atomically, so that you don't have a stray temporary file left lying around if something goes wrong, and don't need to worry about races or the other issues with creating a named temporary file. But unless linkat() could be used to overwrite a file atomically, you're going to have to use rename(), which requires that the file have a name to begin with.
Posted Jul 24, 2013 5:49 UTC (Wed)
by kevinm (guest, #69913)
[Link]
Posted Jul 24, 2013 6:14 UTC (Wed)
by jzbiciak (guest, #5246)
[Link]
Fair enough.
You could always create the new file with /path/to/replace_gobbledegook_hash_suffix before atomically moving it over the file you're replacing. You lose the anonymity benefit, though, because you are eventually forced to come up with a filename.
I guess the AT_REPLACE suggestion kevinm made earlier would close everything up nicely.
Can the O_TMPFILE later be saved with real name ?
Can the O_TMPFILE later be saved with real name ?
Can the O_TMPFILE later be saved with real name ?
That works for creating a new file atomically, but not for rewriting an existing file, since you can't use linkat() on a path that already exists.
Can the O_TMPFILE later be saved with real name ?
Can the O_TMPFILE later be saved with real name ?
Can the O_TMPFILE later be saved with real name ?