Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Nick Craig-Wood
8fd2577694 mount,cmount: run Release asynchronously
Before this change the mount and cmount would run Release
synchronously.  This would mean that it would wait for files to be
closed (eg uploaded) before returning to the kernel.

However Release is already running asynchronously from userspace so
this commit changes it to do the functionality of Release
asynchronously too.

This should fix libfuse blocking when Release is active and it is
asked to do something else with a file.

Forum: https://forum.rclone.org/t/vfs-cache-mode-writes-upload-expected-behaviour/8014
2019-05-11 10:21:43 +01:00
2 changed files with 10 additions and 2 deletions

View file

@ -388,7 +388,11 @@ func (fsys *FS) Release(path string, fh uint64) (errc int) {
return errc return errc
} }
_ = fsys.closeHandle(fh) _ = fsys.closeHandle(fh)
return translateError(handle.Release()) // Run the Release asynchronously, ignoring errors
go func() {
_ = handle.Release()
}()
return 0
} }
// Unlink removes a file. // Unlink removes a file.

View file

@ -80,5 +80,9 @@ var _ fusefs.HandleReleaser = (*FileHandle)(nil)
// the kernel // the kernel
func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error) { func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error) {
defer log.Trace(fh, "")("err=%v", &err) defer log.Trace(fh, "")("err=%v", &err)
return translateError(fh.Handle.Release()) // Run the Release asynchronously, ignoring errors
go func() {
_ = fh.Handle.Release()
}()
return nil
} }