History

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.

Nick Craig-Wood committed 7 years ago

Commit 8fd25771 parent f8652802 files · +10 −2Browse files

Showing the changes to cmd (2 of 2 files). Show all

Unified · Split

2 files
  1. cmd/cmount/fs.go +5 −1
  2. cmd/mount/handle.go +5 −1
cmd/cmount/fs.go+5−1
@@ -388,7 +388,11 @@ func (fsys *FS) Release(path string, fh uint64) (errc int) { · 387 unmodified lines
388 return errc388 return errc
389 }389 }
390 _ = fsys.closeHandle(fh)390 _ = fsys.closeHandle(fh)
391 return translateError(handle.Release())391 // Run the Release asynchronously, ignoring errors
392 go func() {
393 _ = handle.Release()
394 }()
395 return 0
392}396}
393 397
394// Unlink removes a file.398// Unlink removes a file.
cmd/mount/handle.go+5−1
@@ -80,5 +80,9 @@ var _ fusefs.HandleReleaser = (*FileHandle)(nil) · 79 unmodified lines
80// the kernel80// the kernel
81func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error) {81func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error) {
82 defer log.Trace(fh, "")("err=%v", &err)82 defer log.Trace(fh, "")("err=%v", &err)
83 return translateError(fh.Handle.Release())83 // Run the Release asynchronously, ignoring errors
84 go func() {
85 _ = fh.Handle.Release()
86 }()
87 return nil
84}88}