[ARVADOS] updated: 50be38a022fe282c55703c9e3903b0400eaa20fb

git at public.curoverse.com git at public.curoverse.com
Wed Mar 25 11:44:27 EDT 2015

Summary of changes:
 services/keepstore/volume_unix.go | 8 ++++++++
 1 file changed, 8 insertions(+)

       via  50be38a022fe282c55703c9e3903b0400eaa20fb (commit)
      from  8805632994d42c0e3b31fd5ac010d916cac12de1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

commit 50be38a022fe282c55703c9e3903b0400eaa20fb
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Wed Mar 25 11:48:06 2015 -0400

    Added a comment to volume Delete() about race condition.

diff --git a/services/keepstore/volume_unix.go b/services/keepstore/volume_unix.go
index 4db2a53..84877c0 100644
--- a/services/keepstore/volume_unix.go
+++ b/services/keepstore/volume_unix.go
@@ -255,6 +255,14 @@ func (v *UnixVolume) Index(prefix string) (output string) {
 func (v *UnixVolume) Delete(loc string) error {
+	// Touch() must be called before calling Write() on a block.  Touch()
+	// also uses lockfile().  This avoids a race condition between Write()
+	// and Delete() because either (a) the file will be deleted and Touch()
+	// will signal to the caller that the file is not present (and needs to
+	// be re-written), or (b) Touch() will update the file's timestamp and
+	// Delete() will read the correct up-to-date timestamp and choose not to
+	// delete the file.
 	p := v.blockPath(loc)
 	f, err := os.OpenFile(p, os.O_RDWR|os.O_APPEND, 0644)
 	if err != nil {



More information about the arvados-commits mailing list