fusefrontend: drop atime workarounds

The fix at https://github.com/hanwen/go-fuse/pull/131 has been merged.
Drop the workarounds and re-enable the tests.
This commit is contained in:
Jakob Unterwurzacher 2016-10-30 16:29:36 +01:00
parent 4e95d394cf
commit c2192cfcad
2 changed files with 2 additions and 23 deletions

View File

@ -398,22 +398,7 @@ func (f *file) GetAttr(a *fuse.Attr) fuse.Status {
return fuse.OK return fuse.OK
} }
// BrokenAtime means that atime support is broken.
// TODO drop this once https://github.com/hanwen/go-fuse/pull/131 is
// merged
const BrokenAtime = true
func (f *file) Utimens(a *time.Time, m *time.Time) fuse.Status { func (f *file) Utimens(a *time.Time, m *time.Time) fuse.Status {
if BrokenAtime {
if m == nil {
tlog.Warn.Printf("refusing to set the atime to prevent a crash in go-fuse")
return fuse.EINVAL
}
// Due to a bug in loopbackFile.Utimens, the "a" value will be used
// to set both mtime and atime. Because mtime is more important, we
// override "a".
a = m
}
f.fdLock.RLock() f.fdLock.RLock()
defer f.fdLock.RUnlock() defer f.fdLock.RUnlock()
return f.loopbackFile.Utimens(a, m) return f.loopbackFile.Utimens(a, m)

View File

@ -25,7 +25,6 @@ import (
"testing" "testing"
"github.com/rfjakob/gocryptfs/internal/cryptocore" "github.com/rfjakob/gocryptfs/internal/cryptocore"
"github.com/rfjakob/gocryptfs/internal/fusefrontend"
"github.com/rfjakob/gocryptfs/internal/syscallcompat" "github.com/rfjakob/gocryptfs/internal/syscallcompat"
"github.com/rfjakob/gocryptfs/tests/test_helpers" "github.com/rfjakob/gocryptfs/tests/test_helpers"
) )
@ -686,18 +685,13 @@ func doTestUtimesNano(t *testing.T, path string) {
}, },
{ {
in: [2]syscall.Timespec{{Sec: 7, Nsec: 8}, {Sec: 99, Nsec: _UTIME_OMIT}}, in: [2]syscall.Timespec{{Sec: 7, Nsec: 8}, {Sec: 99, Nsec: _UTIME_OMIT}},
out: [2]syscall.Timespec{{Sec: 7, Nsec: 8}, {Sec: 5, Nsec: 6}}, out: [2]syscall.Timespec{{Sec: 7, Nsec: 8}, {Sec: 3, Nsec: 4}},
}, },
{ {
in: [2]syscall.Timespec{{Sec: 99, Nsec: _UTIME_OMIT}, {Sec: 5, Nsec: 6}}, in: [2]syscall.Timespec{{Sec: 99, Nsec: _UTIME_OMIT}, {Sec: 5, Nsec: 6}},
out: [2]syscall.Timespec{{Sec: 1, Nsec: 2}, {Sec: 5, Nsec: 6}}, out: [2]syscall.Timespec{{Sec: 7, Nsec: 8}, {Sec: 5, Nsec: 6}},
}, },
} }
if fusefrontend.BrokenAtime {
// TODO remove this once the pull request is merged:
// https://github.com/hanwen/go-fuse/pull/131
utimeTestcases = utimeTestcases[:1]
}
for i, tc := range utimeTestcases { for i, tc := range utimeTestcases {
err := syscall.UtimesNano(path, tc.in[:]) err := syscall.UtimesNano(path, tc.in[:])
if err != nil { if err != nil {