diff options
author | Jakob Unterwurzacher | 2020-05-24 23:36:11 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2020-05-24 23:36:11 +0200 |
commit | 71c0481f0e42c6bf1749dde8a30d9a6b728e83a0 (patch) | |
tree | ee80221645e542cd788c40219d5e83f4b1164e09 /internal/fusefrontend | |
parent | 15ff79bf144cc8fe780bffdd7447dfbb5df604a8 (diff) |
Revert "fusefrontend: don't always clear the dircache in Rename"
As noticed by @slackner in
https://github.com/rfjakob/gocryptfs/commit/cb8872577d66ff0fc38bcd70493be06bc0f34ffa#commitcomment-39405233 ,
this is not safe.
This reverts commit cb8872577d66ff0fc38bcd70493be06bc0f34ffa.
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r-- | internal/fusefrontend/fs.go | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go index db473ee..e8dae9f 100644 --- a/internal/fusefrontend/fs.go +++ b/internal/fusefrontend/fs.go @@ -533,6 +533,7 @@ func (fs *FS) Symlink(target string, linkName string, context *fuse.Context) (co // // Symlink-safe through Renameat(). func (fs *FS) Rename(oldPath string, newPath string, context *fuse.Context) (code fuse.Status) { + defer fs.dirCache.Clear() if fs.isFiltered(newPath) { return fuse.EPERM } @@ -548,9 +549,6 @@ func (fs *FS) Rename(oldPath string, newPath string, context *fuse.Context) (cod defer syscall.Close(newDirfd) // Easy case. if fs.args.PlaintextNames { - // The rename may replace another directory. Make sure we drop the - // deleted directory from the cache. - defer fs.dirCache.Clear() return fuse.ToStatus(syscallcompat.Renameat(oldDirfd, oldCName, newDirfd, newCName)) } // Long destination file name: create .name file @@ -577,11 +575,6 @@ func (fs *FS) Rename(oldPath string, newPath string, context *fuse.Context) (cod // again. tlog.Debug.Printf("Rename: Handling ENOTEMPTY") if fs.Rmdir(newPath, context) == fuse.OK { - // The rename replaced another directory. Make sure we drop the - // deleted directory from the cache (note: fs.Rmdir also clears it, - // but this is not guaranteed forever, and a double clear does no - // harm). - defer fs.dirCache.Clear() err = syscallcompat.Renameat(oldDirfd, oldCName, newDirfd, newCName) } } |