Package: mount
Version: 2.13~rc2-4
Severity: normal
Tags: patch
While parsing /etc/fstab, swapoff does not make provision for UUID= and LABEL=
identifiers. It needs to resolve the device represented by these tokens to
correctly identify if it is present in /proc/swaps via function
is_in_proc_swaps() and attempting to do_swapoff().
At the moment, swapoff needlessly makes alarming noise at shutdown by
attempting to do stuff to a string rather than a block device, which can be
simulated:
# swapoff -a -v
swapoff on /dev/sda6
swapoff: cannot canonicalize UUID=519625a9-a64c-4a37-9277-1e2470644329: No such
file or directory
swapoff on UUID=519625a9-a64c-4a37-9277-1e2470644329
Use fsprobe_get_devname() to resolve actual device name, just as it is done
for swapon -a.
diff -Nrup util-linux-2.13~rc2/mount/swapon.c
util-linux-2.13~rc2.patched/mount/swapon.c
--- util-linux-2.13~rc2/mount/swapon.c 2007-06-29 20:19:34.000000000 +1000
+++ util-linux-2.13~rc2.patched/mount/swapon.c 2007-08-02 00:21:48.000000000
+1000
@@ -491,9 +491,18 @@ main_swapoff(int argc, char *argv[]) {
exit(2);
}
while ((fstab = getmntent(fp)) != NULL) {
- if (streq(fstab->mnt_type, MNTTYPE_SWAP) &&
- !is_in_proc_swaps(fstab->mnt_fsname))
- do_swapoff(fstab->mnt_fsname, QUIET);
+ const char *orig_special = fstab->mnt_fsname;
+ const char *special;
+
+ if (!streq(fstab->mnt_type, MNTTYPE_SWAP))
+ continue;
+
+ special = fsprobe_get_devname(orig_special);
+ if (!special)
+ continue;
+
+ if (!is_in_proc_swaps(special))
+ do_swapoff(special, QUIET);
}
fclose(fp);
}
---
Thanks, Kel.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]