From ec3eaf0b8776500a9762555eac754b6c893420fd Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 14 Oct 2020 13:40:12 +0200 Subject: syscallcompat: don't retry Close() After Close() returns, the fd is dead, even if we received EINTR. Don't retry, we could shoot down an unrelated fd that received the same fd number. --- internal/fusefrontend/file.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'internal/fusefrontend') diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go index 0367705..98e5802 100644 --- a/internal/fusefrontend/file.go +++ b/internal/fusefrontend/file.go @@ -391,9 +391,9 @@ func (f *File) Release(ctx context.Context) syscall.Errno { } f.released = true openfiletable.Unregister(f.qIno) - f.fd.Close() + err := f.fd.Close() f.fdLock.Unlock() - return 0 + return fs.ToErrno(err) } // Flush - FUSE call @@ -401,15 +401,7 @@ func (f *File) Flush(ctx context.Context) syscall.Errno { f.fdLock.RLock() defer f.fdLock.RUnlock() - // Since Flush() may be called for each dup'd fd, we don't - // want to really close the file, we just want to flush. This - // is achieved by closing a dup'd fd. - newFd, err := syscall.Dup(f.intFd()) - - if err != nil { - return fs.ToErrno(err) - } - err = syscallcompat.Close(newFd) + err := syscallcompat.Flush(f.intFd()) return fs.ToErrno(err) } -- cgit v1.2.3