Temporary and partial files should have 0666 permissions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
FileStore |
Fix Released
|
High
|
Jason Gerard DeRose |
Bug Description
ext4 is the recommended filesystem to use with Dmedia, including on removable drives. As FileStore aggressively uses ext4 fallocate() whenever it can, the performance benefit is just too good to turn down.
However, ext4 can be a touch annoying on removable drives when sharing between different users, or when the same user happens to have a different numeric ID on different computers. This is why directories in the FileStore layout all have 0777 permissions and canonical files have 0444 permissions.
The one place we don't yet do the right thing is with temporary and partial files. As it stands now, a user with a different numeric ID wont be able to resume a download/upload, nor will they be able to purge stale temporary files. The fix is to have FileStore.
The reason I'm doing this now is that when a FileStore is first attached in Dmedia, we should really purge any stale temporary files found in .dmedia/tmp/ so they don't accumulate over time.
On POSIX systems, os.rename() is atomic, meaning a file is always well defined as being either in the FileStore or not, so deleting these temporary files is fair game. Higher-level code in Dmedia should never count a file in .dmedia/tmp/ as having reached a "stored" state in the FileStore.
FYI, we're not going to automatically delete partial or corrupt files.
There's really no reason to ever delete corrupt files... if you're accumulating corrupt files, then your hard drive is failing or you have some other spectacular hardware reliability problem. We'll leave corrupt files for forensic reasons and in case the complete file can be restored from multiple corrupt files (which it can as long as the corruption isn't in the same leaves).
And partial files are tracked specially by Dmedia, so we trust Dmedia to handle partial files correctly.
Related branches
- Jason Gerard DeRose: Approve
-
Diff: 87 lines (+11/-1)2 files modifiedfilestore.py (+2/-0)
test_filestore.py (+9/-1)
Changed in filestore: | |
status: | In Progress → Fix Committed |
Changed in filestore: | |
status: | Fix Committed → Fix Released |