From 00af4f48643f0533b6cfbd14fdf5186c844f8f5d Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 6 Oct 2019 21:27:38 +0200 Subject: [PATCH] fusefrontend: unregister from openfiletable before closing the fd Closing the fd means the inode number may be reused immediately by a new file, so we have to get the old fileID out of the table beforehand! Hopefully fixes https://github.com/rfjakob/gocryptfs/issues/363 --- internal/fusefrontend/file.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go index 3313934..74a56c3 100644 --- a/internal/fusefrontend/file.go +++ b/internal/fusefrontend/file.go @@ -401,11 +401,10 @@ func (f *File) Release() { if f.released { log.Panicf("ino%d fh%d: double release", f.qIno.Ino, f.intFd()) } - f.fd.Close() f.released = true - f.fdLock.Unlock() - openfiletable.Unregister(f.qIno) + f.fd.Close() + f.fdLock.Unlock() } // Flush - FUSE call