forked from TrueCloudLab/rclone
mount: Fix read flushing - fixes #638
This commit is contained in:
parent
265f5b77a7
commit
392a86f585
2 changed files with 18 additions and 12 deletions
|
@ -116,6 +116,11 @@ func (fh *ReadFileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) err
|
||||||
fh.mu.Lock()
|
fh.mu.Lock()
|
||||||
defer fh.mu.Unlock()
|
defer fh.mu.Unlock()
|
||||||
fs.Debug(fh.o, "ReadFileHandle.Flush")
|
fs.Debug(fh.o, "ReadFileHandle.Flush")
|
||||||
|
|
||||||
|
// Ignore the Flush as there is nothing we can sensibly do and
|
||||||
|
// it seems quite common for Flush to be called from
|
||||||
|
// different threads each of which have read some data.
|
||||||
|
if false {
|
||||||
// If Read hasn't been called then ignore the Flush - Release
|
// If Read hasn't been called then ignore the Flush - Release
|
||||||
// will pick it up
|
// will pick it up
|
||||||
if !fh.readCalled {
|
if !fh.readCalled {
|
||||||
|
@ -128,6 +133,7 @@ func (fh *ReadFileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) err
|
||||||
fs.ErrorLog(fh.o, "ReadFileHandle.Flush error: %v", err)
|
fs.ErrorLog(fh.o, "ReadFileHandle.Flush error: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fs.Debug(fh.o, "ReadFileHandle.Flush OK")
|
fs.Debug(fh.o, "ReadFileHandle.Flush OK")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,9 +72,9 @@ func TestReadFileDoubleClose(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, 1, n)
|
assert.Equal(t, 1, n)
|
||||||
|
|
||||||
// close the dup - should produce an error
|
// close the dup - should not produce an error
|
||||||
err = syscall.Close(fd2)
|
err = syscall.Close(fd2)
|
||||||
assert.Error(t, err, "input/output error")
|
assert.NoError(t, err, "input/output error")
|
||||||
|
|
||||||
run.rm(t, "testdoubleclose")
|
run.rm(t, "testdoubleclose")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue