Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fixing swap1_stop



On Thu, 3 Aug 2017 10:54:30 +0000 (UTC) christos%astron.com@localhost (Christos
Zoulas) wrote:

> In article <20170802215811.02ff2faba38001ebe4f531eb%fastmail.fm@localhost>,
> Ian D. Leroux <idleroux%fastmail.fm@localhost> wrote:
> >The patches stop swap1_stop from blindly unmounting
> >a tmpfs-mounted /dev/while the system is still running multi-user. 
>
> [...]
> 
> Why not just skip /dev?
>
> echo -n "Forcibly unmounting tmpfs filesystems:"
> mount -t tmpfs | while read tmpfs on dir rest; do
>         case "$dir" in
>         /dev)
>                 echo -n " [skipping $dir]"
>                 ;;
>         *)
>                 echo -n " $dir"
>                 umount -f "$dir"
>         esac
> done
> echo "."

A couple of not-very-convincing reasons:
1- That loop isn't, as far as I can see, robust to pathnames with
spaces in them.  "/dev" has no space, but some other directory with a
tmpfs mount might, and the attempt to unmount will then (at best) fail
noisily.
2- Hard-coding a single special directory smells wrong.  There might be
device nodes elsewhere than in /dev.

In general, I think that having swap1 unmount filesystems in the hope
of ensuring that the remaining contents of virtual memory fit into RAM
is several ugly modularity violations rolled into one.  I suspect, but
haven't proved, that any heuristic we come up with for choosing the
filesystems (not) to unmount will get it wrong in at least some cases.
That's why the consensus last year was that there should be a documented
mechanism to override the defaults and let an administrator
explicitly specify which, if any, filesystems swap1 is allowed to
unmount.  I don't actually much care what the default is (whether "/tmp
and /var/shm" , "everything but /dev" or "all tmpfs that contain no
device nodes" as I currently have it).  I mostly want a documented way
to override it.

--
IDL


Home | Main Index | Thread Index | Old Index