From 96d53cf60fce6b45fd32988bab70b059428fe99c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 23 Mar 2013 16:13:08 +0200 Subject: [PATCH] vboxsf: stop mounts before removing modules --- VirtualBox-vboxsf.init | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/VirtualBox-vboxsf.init b/VirtualBox-vboxsf.init index 494ee23..0011bf0 100755 --- a/VirtualBox-vboxsf.init +++ b/VirtualBox-vboxsf.init @@ -23,8 +23,23 @@ start() { } stop() { - # NOTE: rmmod will wait if device is in use, so automatic rmmod probably is not the best idea + # umount vboxsf mounts, no retry, just don't stack them :) + local mount errors out rc=0 + show "Unmounting vboxsf file systems"; busy + awk '$3 == "vboxsf" {print $2}' /proc/mounts | while read mount; do + if ! umount "$mount"; then + rc=$? + fi + done + if [ $rc = 0 ]; then + ok + else + fail + fi + + # NOTE: rmmod will say module in use if there are remaining mounts /sbin/rmmod $VBOX_MODULE + rm -f /var/lock/subsys/vboxsf } -- 2.44.0