Opened 14 years ago

Closed 14 years ago

#1010 closed Defect (fixed)

[PATCH] boinc_rename very not atomic on Windows

Reported by: MattArsenault Owned by: davea
Priority: Minor Milestone: Undetermined
Component: BOINC - API Version: 6.10.58
Keywords: rename, atomic, move Cc:

Description

boinc_rename is very not atomic on Windows. The posix version uses the standard and atomic rename() function, but the Win32 API (until Vista) doesn't have a way to get atomic file updates. boinc_rename on Win32 deletes the original file before moving the old one, increasing the chance of problems if the system is interrupted in between. You can get closer to atomic rename by using MoveFileEx? with the MOVEFILE_REPLACE_EXISTING and MOVEFILE_WRITE_THROUGH flags.

Attachments (1)

UseMoveFileEx.diff (1.5 KB) - added by MattArsenault 14 years ago.

Download all attachments as: .zip

Change History (3)

Changed 14 years ago by MattArsenault

Attachment: UseMoveFileEx.diff added

comment:1 Changed 14 years ago by MattArsenault

This patch is for the svn trunk.

comment:2 Changed 14 years ago by davea

Resolution: fixed
Status: newclosed

(In [22364]) - client (Win): use MoveFileEx?() to rename file.

More atomic than delete/rename. fixes #1010

Note: See TracTickets for help on using tickets.