Race state when moving files on Linux

Suppose I have two scenarios. The first puts (with the mv command) some files into the directory, the second checks the directory once in a while and processes the files. The situation I'm worried about is when the second script starts processing a file that is only partially moving at the moment. Could this happen in real life on an XFS file system?

+5
source share
2 answers

It depends on where you are moving the files from. mv On one file system, it is atomic, otherwise it must make a copy that is not atomic (followed by the deletion of the original file) and is prone to the kind of race condition that you mention.

FWIW, POSIX, XFS.

+6

XFS. XFS , inode Unix. XFS- .

XFS - . - , .

- , . - .

+1

All Articles