Re: mkswap/swapon problems

From: Andries Brouwer (aeb@veritas.com)
Date: Fri Sep 22 2000 - 16:00:19 EST


On Fri, Sep 22, 2000 at 04:59:11PM +0200, Pavel Machek wrote:

> test8 exhibits rather strange behaviour:
>
> root@bug:~# ls -al /tmp/swap
> -rw-r--r-- 1 root root 27164672 Sep 22 16:58 /tmp/swap
> root@bug:~# mkswap /tmp/swap
> Setting up swapspace, size = 27160576 bytes
> root@bug:~# swapon /tmp/swap
> swapon: /tmp/swap: Invalid argument
> root@bug:~# sync
> root@bug:~# swapon /tmp/swap
> root@bug:~#

For me:

# dd if=/dev/zero of=/b2/tmp/swap bs=1024 count=26528
26528+0 records in
26528+0 records out
# ls -al /b2/tmp/swap
-rw-r--r-- 1 aeb users 27164672 Sep 22 22:37 /b2/tmp/swap
# mkswap /b2/tmp/swap
Setting up swapspace version 1, size = 27160576 bytes
# swapon /b2/tmp/swap
#

So, first observation: you have an old mkswap.

Second observation: I presume that because of some aliasing,
the swap signature was not seen at first. The present mkswap
source says:

        /*
         * A subsequent swapon() will fail if the signature
         * is not actually on disk. (This is a kernel bug.)
         */
        if (fsync(DEV))
                 die(_("fsync failed"));

that is, current mkswap already does the sync that you did by hand.
It has been required for a long time.

Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 21:00:28 EST