On 21/08/24 at 01:34, Thorsten Glaser wrote:
(Please d̲o̲ Cc me on replies, I don’t subscribe to this list. Thanks!)
<snip>
Just adding a “sleep” is no proper fix anyway, so the question is, how to wait in a shell script until the swap device is *really* swapoff’d when the syscall returns too early, and (someone from the Linux kernel maintainers reading this?) should I report the latter as a bug against the kernel?
I don't think this as a kernel bug, many stuffs have timeout on all OSes, however you can stop the execution flow of a script using an endless loop then interrupt it when a condition is satisfied, e.g.:
while true do /usr/bin/grep lv-swp1 /proc/swaps >/dev/null 2>&1 [ $? -ne 0 ] && break /usr/bin/sleep 1 done HTH P.S. To other readers, the OP asked to Cc to him when replying, see above -- Franco Martelli