GoogleCloudPlatform / GoogleCloudPlatform/gcsfuse
Issue: Temp file disk space leak when writeback cache is enabled and FUSE_WRITE returns error
- Dominant language
- Go
- Stars
- 2.3k
- Forks
- 510
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 35
Description
Summary
When writeback cache is enabled (default) and a FUSE_WRITE request returns an error (e.g., any I/O error), the temp file associated with the inode is never cleaned up until the kernel sends ForgetInode . This causes temp directory disk space to remain occupied indefinitely.
Root Cause
The issue is caused by an interaction between the Linux FUSE kernel module's writeback cache error handling and gcsfuse's temp file lifecycle management.
When FUSE_WRITE returns an error, the kernel sets AS_EIO in mapping->flags. On close(), fuse_flush() detects this via filemap_check_errors() and returns early — without sending FUSE_FLUSH to userspace
The temp file remains on disk, consuming space, until the kernel eventually sends ForgetInode (which depends on dentry cache eviction — unpredictable and potentially very long if the file still exists in the directory)
Contributor guide
Research direction
Start by tracing gcsfuse's temp-file lifecycle for an inode through FUSE_WRITE errors, close(), fuse_flush(), and ForgetInode. Reproduce the writeback-cache failure path and verify that the temp file is cleaned up after an error without waiting for ForgetInode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, linux
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100