[packages/VirtualBox] vboxsf: stop mounts before removing modules

glen glen at pld-linux.org
Sat Mar 23 15:13:42 CET 2013


commit 96d53cf60fce6b45fd32988bab70b059428fe99c
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sat Mar 23 16:13:08 2013 +0200

    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
 }
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/VirtualBox.git/commitdiff/96d53cf60fce6b45fd32988bab70b059428fe99c



More information about the pld-cvs-commit mailing list