Your message dated Fri, 23 Jul 2010 21:32:30 +0000
with message-id <[email protected]>
and subject line Bug#582891: fixed in nbd 1:2.9.15-4
has caused the Debian Bug report #582891,
regarding nbd-client: nbd-client stop attempts to umount non-existent fs
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
582891: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=582891
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: nbd-client
Version: 1:2.9.15-1
Severity: minor
Tags: patch

If KILLALL is set false in /etc/nbd-client, then the init script
attempts to umount all listed devices, even those that are selected to
be swap devices.  This means an error and a long wait for every network
swap device.

My patch corrects this by being selective about which devices to umount
and which to swapoff.

The only change when KILLALL is not false is to swapoff only devices
listed in /proc/swaps if that exists.  If /proc/swaps does not exist,
then we get the old behaviour of swapoff all devices.

As I use nbd only for swaps, and have no filesystems other than NFS in
my kernel (diskless embedded device) it would be worth verifying with
filesystems before committing - sorry I'm not in a position to have
tested that.  But I'm pretty confident I haven't broken it.

Here's the patch:

--- etc/init.d/nbd-client.dpkg-dist	2010-03-24 22:08:02.000000000 +0000
+++ etc/init.d/nbd-client	2010-05-24 12:33:11.000000000 +0100
@@ -38,6 +38,57 @@
 
 test -x $DAEMON || exit 0
 
+get_devices() {
+    DEVICES=
+    i=0
+    while [ ! -z ${NBD_DEVICE[$i]} ]
+    do
+	if [ ${NBD_TYPE[$i]} == "$1" ]
+	then
+	    DEVICES="$DEVICES ${NBD_DEVICE[$i]}"
+	fi
+	i=$(($i + 1))
+    done
+}
+
+get_all_devices() {
+	if [ "$KILLALL" == "false" ]
+	then
+	    DEVICES=${NBD_DEVICE[*]}
+	else
+	    if [ -d /dev/nbd ]
+	    then
+		    DEVICES=/dev/nbd/*
+	    else
+		    DEVICES=/dev/nb*
+	    fi
+	fi
+}
+
+get_swap_devices() {
+	if [ "$KILLALL" == "false" ]
+	then
+	    get_devices s
+	else
+	    if [ -f /proc/swaps ]
+	    then
+		DEVICES=`grep '^/dev/nb' /proc/swaps | cut -d ' ' -f1`
+	    else
+		get_all_devices
+	    fi
+	fi
+}
+
+get_mount_devices() {
+	if [ "$KILLALL" == "false" ]
+	then
+	    get_devices f
+	else
+	    DEVICES=`mount | cut -d " " -f 1 | grep /dev/nbd`
+	fi
+}
+
+
 case "$1" in
     connect)
 	# I don't use start-stop-daemon: nbd-client only does some setup
@@ -134,19 +185,14 @@
 	;;
     stop)
 	echo "Stopping $DESC: "
-	echo "umounting all filesystems for nbd-blockdevices..."
-	if [ "$KILLALL" != "false" ]
-	then
-	  DEVICES=`mount | cut -d " " -f 1 | grep /dev/nbd`
-	else
-	  DEVICES=${NBD_DEVICE[*]}
-	fi
+	get_mount_devices
 	for dev in $DEVICES
 	do
 	  # Ignore devices with _netdev option (sysvinit takes care of those)
 	  line=$(grep $dev /etc/fstab | grep "_netdev")
 	  if [ -z "$line" ]
 	  then
+	    echo "umounting filesystem from $dev..."
 	    umount $dev 2>/dev/null
 	    if [ $? -eq 1 ]
 	    then
@@ -162,20 +208,16 @@
 	  fi
 	  echo $dev
 	done
-	if [ "$KILLALL" != "false" ]
-	then
-	    if [ -d /dev/nbd ]
+	get_swap_devices
+	if [ "$DEVICES" ]
 	    then
-		    DEVICES=/dev/nbd/*
-	    else
-		    DEVICES=/dev/nb*
-	    fi
+	    echo "Invoking swapoff on $DEVICES..."
+	    swapoff $DEVICES 2>/dev/null
 	fi
-	echo "Invoking swapoff on NBD devices..."
-	swapoff $DEVICES 2>/dev/null
-	echo "Disconnecting $DESCes..."
+	get_all_devices
 	for i in $DEVICES
-	  do
+	do
+	  echo "Disconnecting $i"
 	  $DAEMON -d $i 2>/dev/null >/dev/null
 	done
 	rmmod nbd

--- End Message ---
--- Begin Message ---
Source: nbd
Source-Version: 1:2.9.15-4

We believe that the bug you reported is fixed in the latest version of
nbd, which is due to be installed in the Debian FTP archive:

nbd-client-udeb_2.9.15-4_amd64.udeb
  to main/n/nbd/nbd-client-udeb_2.9.15-4_amd64.udeb
nbd-client_2.9.15-4_amd64.deb
  to main/n/nbd/nbd-client_2.9.15-4_amd64.deb
nbd-server_2.9.15-4_amd64.deb
  to main/n/nbd/nbd-server_2.9.15-4_amd64.deb
nbd_2.9.15-4.diff.gz
  to main/n/nbd/nbd_2.9.15-4.diff.gz
nbd_2.9.15-4.dsc
  to main/n/nbd/nbd_2.9.15-4.dsc



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Wouter Verhelst <[email protected]> (supplier of updated nbd package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Fri, 23 Jul 2010 22:57:26 +0200
Source: nbd
Binary: nbd-server nbd-client nbd-client-udeb
Architecture: source amd64
Version: 1:2.9.15-4
Distribution: unstable
Urgency: low
Maintainer: Wouter Verhelst <[email protected]>
Changed-By: Wouter Verhelst <[email protected]>
Description: 
 nbd-client - Network Block Device protocol - client
 nbd-client-udeb - Network Block Device protocol - client for Debian Installer 
(udeb)
 nbd-server - Network Block Device protocol - server
Closes: 582891 583536
Changes: 
 nbd (1:2.9.15-4) unstable; urgency=low
 .
   * Be a bit more peculiar about what we do to devices on stop, to avoid
     errors and (thus) delays on swapoff. Thanks, Toby Speight; Closes:
     #582891.
   * Add Spanish Debconf translation. Thanks, Camaleón; Closes: #583536.
   * Bump Standards-Version to 3.9.0 (no changes applicable to nbd)
Checksums-Sha1: 
 ea8c866a8002f329e4d86fecc251a4e0fdec97e5 1133 nbd_2.9.15-4.dsc
 e3da9d0c45be226b6d020e2c8b6709ea0072df0a 78042 nbd_2.9.15-4.diff.gz
 5802617b71fa92a8dfabeda5e55372503ecf85f1 58822 nbd-server_2.9.15-4_amd64.deb
 fc5ce24658a4f8f3f2473e3a1b7803d98f249ea5 47998 nbd-client_2.9.15-4_amd64.deb
 b2f206bf28d3c27f775c986ef41052e3e074a490 6588 
nbd-client-udeb_2.9.15-4_amd64.udeb
Checksums-Sha256: 
 77bbf0bdc2f42777658e76775a13dfd82fa4afbb147f2836e5e0d387043671bd 1133 
nbd_2.9.15-4.dsc
 84167bb4827c8ceb56c02e4c30012f295daef69dd03eb3efcda295e39cf3c7d4 78042 
nbd_2.9.15-4.diff.gz
 ec7a283ac643e43c92de071242d92bd4f7582257c8e927cd7006d4edb423a057 58822 
nbd-server_2.9.15-4_amd64.deb
 0cdef338edd9017cca13b0ed7f918a909c86966de116c640f72969187fb80d32 47998 
nbd-client_2.9.15-4_amd64.deb
 19c6b3a6f8d2dbf579b2669b2292be60bda9b57f0508bb90a55a8af63c28bf69 6588 
nbd-client-udeb_2.9.15-4_amd64.udeb
Files: 
 102298371007c230b923485905bb9772 1133 admin optional nbd_2.9.15-4.dsc
 b9fc7567c913a86452fa9e7c96ef2cba 78042 admin optional nbd_2.9.15-4.diff.gz
 950c921999fdc389674d4ba4ba1f7350 58822 admin optional 
nbd-server_2.9.15-4_amd64.deb
 a8859ebfb1427b9e427d55fc8403fd55 47998 admin optional 
nbd-client_2.9.15-4_amd64.deb
 d69e980f69e57695f5e358102dfbab19 6588 debian-installer optional 
nbd-client-udeb_2.9.15-4_amd64.udeb
Package-Type: udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkxKCAAACgkQhbxvHru886xQGQCdG9yz9zFdz/Is442OnXekJMd3
ttcAoIMvv5x3jifQKb6pco8a4NnAbc48
=WQSv
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to