projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
17154: Make sure most current user record is loaded.
[arvados.git]
/
services
/
keepstore
/
unix_volume.go
diff --git
a/services/keepstore/unix_volume.go
b/services/keepstore/unix_volume.go
index 9dbb0c3f38865ef4f9d74f5743df5af0bafe6839..1706473cc892c43cbd5ad27751c49f43cbebc075 100644
(file)
--- a/
services/keepstore/unix_volume.go
+++ b/
services/keepstore/unix_volume.go
@@
-172,10
+172,10
@@
func (v *UnixVolume) Touch(loc string) error {
return e
}
defer v.unlockfile(f)
return e
}
defer v.unlockfile(f)
- ts :=
syscall.NsecToTimespec(time.Now().UnixNano()
)
+ ts :=
time.Now(
)
v.os.stats.TickOps("utimes")
v.os.stats.Tick(&v.os.stats.UtimesOps)
v.os.stats.TickOps("utimes")
v.os.stats.Tick(&v.os.stats.UtimesOps)
- err =
syscall.UtimesNano(p, []syscall.Timespec{ts, ts}
)
+ err =
os.Chtimes(p, ts, ts
)
v.os.stats.TickErr(err)
return err
}
v.os.stats.TickErr(err)
return err
}
@@
-303,8
+303,10
@@
func (v *UnixVolume) WriteBlock(ctx context.Context, loc string, rdr io.Reader)
// which produces confusing results in logs and tests. We
// avoid this by setting the output file's timestamps
// explicitly, using a higher resolution clock.
// which produces confusing results in logs and tests. We
// avoid this by setting the output file's timestamps
// explicitly, using a higher resolution clock.
- ts := syscall.NsecToTimespec(time.Now().UnixNano())
- if err = syscall.UtimesNano(tmpfile.Name(), []syscall.Timespec{ts, ts}); err != nil {
+ ts := time.Now()
+ v.os.stats.TickOps("utimes")
+ v.os.stats.Tick(&v.os.stats.UtimesOps)
+ if err = os.Chtimes(tmpfile.Name(), ts, ts); err != nil {
err = fmt.Errorf("error setting timestamps on %s: %s", tmpfile.Name(), err)
v.os.Remove(tmpfile.Name())
return err
err = fmt.Errorf("error setting timestamps on %s: %s", tmpfile.Name(), err)
v.os.Remove(tmpfile.Name())
return err
@@
-697,10
+699,20
@@
func (v *UnixVolume) EmptyTrash() {
err := filepath.Walk(v.Root, func(path string, info os.FileInfo, err error) error {
if err != nil {
v.logger.WithError(err).Errorf("EmptyTrash: filepath.Walk(%q) failed", path)
err := filepath.Walk(v.Root, func(path string, info os.FileInfo, err error) error {
if err != nil {
v.logger.WithError(err).Errorf("EmptyTrash: filepath.Walk(%q) failed", path)
+ // Don't give up -- keep walking other
+ // files/dirs
+ return nil
+ } else if !info.Mode().IsDir() {
+ todo <- dirent{path, info}
return nil
return nil
+ } else if path == v.Root || blockDirRe.MatchString(info.Name()) {
+ // Descend into a directory that we might have
+ // put trash in.
+ return nil
+ } else {
+ // Don't descend into other dirs.
+ return filepath.SkipDir
}
}
- todo <- dirent{path, info}
- return nil
})
close(todo)
wg.Wait()
})
close(todo)
wg.Wait()