Ticket #149 (closed enhancement: fixed)
Opened 19 months ago
Last modified 16 months ago
On shutdown, tmpfs-es should be unmounted before swap
Reported by: | Michał Górny <mgorny.lxt5@mailnull.com> | Owned by: | roy |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | init.d scripts | Version: | 0.4 |
Keywords: | Cc: |
Description
Currently, on shutdown openrc first disables all swaps, and then starts to unmount filesystems. This has the basic defect that if some data placed on tmpfs filesystem is swapped, then user has to wait till kernel moves it back to RAM - and then removes as tmpfs is unmounted. And if tmpfs contains more data than amount of system RAM, swapoff tries to move it into system memory till OOM-killer kills it.
The simpler solution would be to umount all tmpfs-es before doing swapoff, but it won't work if e.g. user places some swap on tmpfs (;. If we'd like to care for such things, openrc scripts should determine some kind of filesystem-swap dependency tree, and first umount all filesystems which don't contain a swapfile; then swapoff/umount rest of them.
Change History
comment:1 Changed 16 months ago by roy
- Status changed from new to closed
- Resolution set to fixed
comment:2 Changed 16 months ago by Michał Górny <web-ha5wki@mgorny.alt.pl>
Well, to be honest I don't think that's the best solution. We shouldn't do other things that initscript name says it does. In most cases it won't break anything but if some user decides to manually run the script to disable swapspaces, he wouldn't probably expect it to remove all data from tmpfs-es.
comment:3 Changed 16 months ago by roy
Whilst I can't argue with your logic, I do think that adding an init script just to unmount tmpfs before swap is a touch overkill. It's also going to look a little odd adding an init script to the boot runlevel that does nothing on start but something on stop.
Fixed in r1528
We can do a tree based approach if really needed later.