siac host -v showed the wrong folder path after rename
BUG REPORT
Stack Trace or error message
Expected Behavior
siad
should not follow renames (mv) on storage locations.
Observed Behavior
siad
kept writing to renamed folder and siac
didn't report the issue.
How to reproduce it (as minimally and precisely as possible)
current folder: /data/sia-1
mount /mnt/blockstorage
mkdir /mnt/blockstorage/data
chown sia:sia -R /mnt/blockstorage/data/
ln -s /mnt/blockstorage/data/ /data_new
cp /data/sia-1 /data_new/sia-1
* Verify access time and filesize the same, so should be identical data*
mv /data /data_old
mv /data_new /data
at this point I wanted to see if the drive was still registering so I check siac host -v
...
Storage Folders:
Used Capacity % Used Path
2.56 GB 256 GB 01.00 /data/sia-1
OK, no errors, and says it's still there, so then I resize the drive to 4TB for the new mounted space. Command runs with no error messages or anything, I checked and it showed my new capacity was 4TB. At this point, I didn't think to check that the .dat file increased because of no error and it made sense that Sia was none the wiser since it was probably just periodically polling for the file based on the defined directory (PS: I now believe Sia keeps an active pointer to the resource)
*Fast forward 12 hours later*
I have a lot of contracts, like 300, more than I think I should. Someone on discord suggests I should restart siad
so I do; Upon restarting I notice my "Used" column went to 0 but I thought maybe that was expected because siastats was reporting it as 0 for a while and apparently the siac
command gives bad results sometimes (hearsay). I attempt to delete data_old
only to find its .dat file is 4TB (should still be 256 GB). That's when I checked and confirmed the .dat in /data/sia-1/ was only 256 GB.
That's when it dawned on me, Sia must contain some type of pointer to the file and when I simply renamed the folder it was still pointing to the same resource. For some reason, I didn't think Sia would keep the resource open or would detect when it was renamed and throw an error or something if it's not capable of handling it.
Maybe I did something wrong (likely) but I still believe that if Sia was still reading and using .dat file in /data_old/sia-1
then the siac
should not show it was still pointing to /data/sia-1
Environment
- Sia version: 1.5.6
- OS: Debian 10