projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
4024: Add test for double-load bug.
[arvados.git]
/
services
/
keepstore
/
volume_unix.go
diff --git
a/services/keepstore/volume_unix.go
b/services/keepstore/volume_unix.go
index f43997860061eb45688dcd9fa28cde40557e2194..4db2a5338400af7aa8c31089df63cf8cf71c502e 100644
(file)
--- a/
services/keepstore/volume_unix.go
+++ b/
services/keepstore/volume_unix.go
@@
-103,6
+103,7
@@
func (v *UnixVolume) Touch(loc string) error {
if err != nil {
return err
}
if err != nil {
return err
}
+ defer f.Close()
if e := lockfile(f); e != nil {
return e
}
if e := lockfile(f); e != nil {
return e
}
@@
-112,6
+113,15
@@
func (v *UnixVolume) Touch(loc string) error {
return syscall.Utime(p, &utime)
}
return syscall.Utime(p, &utime)
}
+func (v *UnixVolume) Mtime(loc string) (time.Time, error) {
+ p := v.blockPath(loc)
+ if fi, err := os.Stat(p); err != nil {
+ return time.Time{}, err
+ } else {
+ return fi.ModTime(), nil
+ }
+}
+
// Read retrieves a block identified by the locator string "loc", and
// returns its contents as a byte slice.
//
// Read retrieves a block identified by the locator string "loc", and
// returns its contents as a byte slice.
//
@@
-250,7
+260,10
@@
func (v *UnixVolume) Delete(loc string) error {
if err != nil {
return err
}
if err != nil {
return err
}
- lockfile(f)
+ defer f.Close()
+ if e := lockfile(f); e != nil {
+ return e
+ }
defer unlockfile(f)
// If the block has been PUT more recently than -permission_ttl,
defer unlockfile(f)
// If the block has been PUT more recently than -permission_ttl,