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.
Showing the changes to cmd (2 of 2 files). Show all
Unified · Split
| @@ -388,7 +388,11 @@ func (fsys *FS) Release(path string, fh uint64) (errc int) { · 387 unmodified lines | ||
| 388 | 388 | return errc |
| 389 | 389 | } |
| 390 | 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 | 398 | // Unlink removes a file. |
| @@ -80,5 +80,9 @@ var _ fusefs.HandleReleaser = (*FileHandle)(nil) · 79 unmodified lines | ||
| 80 | 80 | // the kernel |
| 81 | 81 | func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error) { |
| 82 | 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 | } |