Open JuniorJPDJ opened 3 years ago
Probably handling SIGHUP to dump cache is as close to a convention as we can get. At least it's better then creating some special meaning files.
By the way you will probably still have to restart software using ziprofs because it likely doesn't handle file handles becoming invalid well. Software that can handle that also survives ziprofs restart as I can attest from my everyday usage.
We could close any cached files and refresh handles inside ZipROFS to make this seamless
The solution I've in my mind is clearing cache and freezing ZipROFS process until underlying FS remounts
I don't think there is a way for ziprofs to distinguish between empty root and not mounted root. So freeze/unfreeze triggers have to be external, you could use SIGUSR1/2 for that.
I meant just freezing whole process with SIGSTOP
:D
That works too but then you can't clear cache while the process is frozen.
I would guess it would process SIGUSR
before anything other after unfreezing.
We could also provide SIGTSTP
as it is being handled by process - which would first clear cache, then freeze process.
I would guess it would process SIGUSR before anything other after unfreezing.
Unless this is documented behavior I wouldn't count on it.
We could also provide SIGTSTP as it is being handled by process - which would first clear cache, then freeze process.
I would rather go for more generic solution. Sometimes dumping cache is useful without freezing process, these operations shouldn't be tied together.
Yes, but it could be function called twice, for SIGUSR
and SIGTSTP
.
So this sounds like a plan:
For refreshing file handles I think we will have to try to refresh non-zip handles as well. For that we will need a mapping of ziprofs handles to system handles instead of current odd-even scheme.
But I probably won't have time to implement this stuff in a while.
We could just drop and zipfiles instead of holding next handles. Those are just open ZipFiles which we can close and reopen using cached implementation if needed.
First thing that came up to my mind was to open some invisible virtual file in main directory. eg.
echo "" > ./.clean_ziprofs_cache
Of course.clean_cache
wouldn't be listed inreaddir()
callAt the moment when I remount underlying filesystem (which was pretty often bcs of bugs in it) I need to remount also ZipROFS and restart all software which was using it. Some workaroundish way to clean cache and reopen existing handles would be helpful.