forked from axboe/fio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix multithread issues when operating on a single shared file
When nrfiles=1, numjobs>1 and create_serialize=0, multiple threads try to create the single shared file in parallel. If the file was pre-existing, but an incorrect size, then multiple threads are deleting and creating at the same time. When all of this happens in parallel, there is a chance that the file can end up the incorrect size (the chance increases as numjobs increases). These changes handle the corner case described above by having a single thread create/extend the file prior to running all of the threads in parallel. By doing this step early, when setup_files() is called later, it should no longer need to create or extend the file, avoiding the race condition. The user still needs to set a fallocate option other than 'none' or the file will end up 0 bytes in size and the race condition will still occur. It would be simple to add a ftruncate() to the code to force this, but that would override the user's choice of fallocate options. Signed-off-by: Chris Weber <weberc@netapp.com>
- Loading branch information
1 parent
02a36ca
commit acbda87
Showing
3 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters