NRK 303bc524e8 do_unmount: add parallel unmounting
this turns mouninfo into a multicall binary which can also do
parallel unmounting. most mountinfo code is unchanged; only
notable change is find_mounts() now returns the number of mounts
found and also takes the "process" function as an argument; so
that is_mounted() can be implemented on top of it.

do_unmount mostly follows the logic of previous code. some
notable changes:

- do_unmount is now "lazy" when it comes to retrying failed
  unmounts. it will greedily keep running unmount as long as it
  can before it looks at the "waiting" queue.
- it will check if the mountpoint is still mounted or not when
  umount returns non-zero exit code. this is due to the fact that
  multiple umount calls might race to unmount a shared mount. so
  if umount fails _but_ the mountpoint is no longer mounted, we
  assume success.
- do_unmount used to fail if fuser did not find any pids using
  the mount. the new code tries one more time; the rationale being
  that there's a gap between the umount call and the fuser call,
  and so whatever was using the mount before might have stopped
  using it now and so it's worth another attempt.

Fixes: https://github.com/OpenRC/openrc/issues/662
Closes: https://github.com/OpenRC/openrc/pull/698
2025-11-12 20:27:33 +01:00
..