Re: [PATCH] swapon: Canonicalize swap device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 14, 2010 at 12:47:48AM +0300, Alexey Gladkov wrote:
> Check that the swap-device has been activated, runs in swapon
> by searching for the device name in /proc/swaps. In the /proc/swaps
> always specifies the path to the real device file, even if the symlink
> passed in the swapon() system call.
> 
> This differs from the situation with /proc/mounts, where
> remembered exactly the string passed in the system call mount*().
> 
> If you use a swap partition on lvm, libblkid returns the name /dev/mapper/*,
> but there are now symlinks pointing to the device files /dev/dm-*,
> resulting the /proc/swaps contain /dev/dm-*, but the swapon is looking
> for /dev/mapper/* and tries to activate the swap partition again.
> 
> Signed-off-by: Alexey Gladkov <gladkov.alexey@xxxxxxxxx>
> ---
>  mount/swapon.c |   12 ++++++++++--
>  1 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/mount/swapon.c b/mount/swapon.c
> index a2dd9dc..a5362ef 100644
> --- a/mount/swapon.c
> +++ b/mount/swapon.c
> @@ -177,7 +177,11 @@ read_proc_swaps(void) {
>  			break;
>  		swapFiles = q;
>  
> -		swapFiles[numSwaps++] = unmangle(line);
> +		if ((p = unmangle(line)) == NULL)
> +			break;
> +
> +		swapFiles[numSwaps++] = canonicalize_path(p);

Implicit declaration of canonicalize_path. You should include
"canonicalize.h"

Otherwise,
Tested-by: Petr Uzel <petr.uzel@xxxxxxx>


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

Attachment: pgpvNLCCLVqs1.pgp
Description: PGP signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux