Problem of swap file

Tung-Han Hsieh (thhsieh@twcpro.phys.ntu.edu.tw)
Thu, 10 Jun 1999 11:16:50 +0800


Dear All,

I want to report a problem which is related to multiple swap files.
I report this problem according to the "REPORTING-BUGS" format.

[1.] swapon/off will fault in multiple swap files.

[2.] I have tried to enable multiple swap files with swapon / off but
found something strange. My procedure is

1. Create swap files:

dd if=/dev/null of=/home/swap/swap1 bs=1024 count=524288
dd if=/dev/null of=/home/swap/swap2 bs=1024 count=524288
mkswap /home/swap/swap1
mkswap /home/swap/swap2

2. Then I tried to swapon them. This step seems OK.

swapon /home/swap/swap1
swapon /home/swap/swap2

3. Then I tried to swapoff them. It seems OK, too.

swapoff /home/swap/swap1
swapoff /home/swap/swap2

4. However, when I tried to swapon swap1 again, it cause segmentation
fault:

swapon /home/swap/swap1 ==> Segmentation fault
cat /proc/swaps ==> Segmentation fault
swapoff /home/swap/swap1 ==>
swapoff: /home/swap/swap1: Invalid argument

If I type "free" command, I see that the swap size does not include
these two swap files.

5. The only way I can think to recover this is to reboot system. Then
I got a "Device or resource busy" message when I try to unmount
the partition /home.

6. However, if I try to swapoff/on only 1 swap file, it seems OK to
do that:

swapon /home/swap/swap1
swapon /home/swap/swap2
swapoff /home/swap/swap2
swapon /home/swap/swap2
swapoff /home/swap/swap2
.......


[3.] Keywords: swap, swapon, swapoff

[4.] Kernel version:
Linux version 2.2.9 (root@twcp3) (gcc version 2.7.2.3) #3 \
Mon Jun 7 15:04:44 CST 1999

[5.] No Oops output here.

[6.] The procedure to trigger the problem is described as above.

[7.] Environment:
[7.1.] Output of ver_linux script:

==========================================================================
-- Versions installed: (if some fields are empty or looks
-- unusual then possibly you have very old versions)
Linux twcp3 2.2.9 #3 Mon Jun 7 15:04:44 CST 1999 i686 unknown
Kernel modules 2.1.121
Gnu C 2.7.2.3
Binutils 2.9.1.0.19
Linux C Library 2.1.1
Dynamic linker ldd (GNU libc) 2.1.1
Procps 1.2.9
Mount 2.9g
Net-tools 2.01
Kbd 0.96
Sh-utils 1.16
Modules Loaded serial via-rhine vfat nfs lockd sunrpc binfmt_aout
==========================================================================

[7.2.] Processor information

==========================================================================
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : 00/07
stepping : 3
cpu MHz : 551.261100
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
sep_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx osfxsr kni
bogomips : 550.50
==========================================================================

[7.3.] Module information:

==========================================================================
serial 18112 0 (autoclean)
via-rhine 8360 1
vfat 11088 0 (unused)
nfs 27932 0 (unused)
lockd 28932 0 [nfs]
sunrpc 48052 0 [nfs lockd]
binfmt_aout 3704 0
==========================================================================

[7.4.] SCSI information

==========================================================================
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: QUANTUM Model: ATLAS IV 9 WLS Rev: 0707
Type: Direct-Access ANSI SCSI revision: 02
==========================================================================

[7.5.] Other information

I use Debian Linux-2.1, but I upgrade the kernel source (the original source
without the Debian patches) to 2.2.9, and the glibc-2.1 (Debian package
libc6-2.1.1-10). Debian Linux-2.1 is ready for kernel-2.2 environment.

The /etc/fstab is:

==========================================================================
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/sda2 / ext2 defaults,errors=remount-ro 0 1
/dev/sda6 none swap sw 0 0
proc /proc proc defaults 0 0
/dev/sda3 /var ext2 defaults 0 2
/dev/sda5 /home ext2 defaults 0 2
==========================================================================

command "fdisk -l /dev/sda" shows

==========================================================================
Disk /dev/sda: 255 heads, 63 sectors, 1116 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 262 2104483+ b Win95 FAT32
/dev/sda2 263 351 714892+ 83 Linux native
/dev/sda3 352 389 305235 83 Linux native
/dev/sda4 390 1116 5839627+ 5 Extended
/dev/sda5 390 1052 5325516 83 Linux native
/dev/sda6 1053 1116 514048+ 82 Linux swap
==========================================================================

Tung-Han Hsieh

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