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
This commit is contained in:
Nick Craig-Wood 2018-12-28 18:07:09 +00:00
parent f865280afa
commit 8fd2577694
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
}
_ = fsys.closeHandle(fh)
return translateError(handle.Release())
// Run the Release asynchronously, ignoring errors
go func() {
_ = handle.Release()
}()
return 0
}
// Unlink removes a file.

View File

@ -80,5 +80,9 @@ var _ fusefs.HandleReleaser = (*FileHandle)(nil)
// the kernel
func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error) {
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
}