[PATCH] OOPS on swapon

Andrzej Krzysztofowicz (ankry@green.mif.pg.gda.pl)
Mon, 7 Jun 1999 11:50:25 +0200 (EEST)


Hi,

> here's how to reproduce it:
> dd if=/dev/zero of=swapfile count=8192
> mkswap -v1 swapfile
> swapon swapfile
> swapon swapfile
> swapoff swapfile
> swapon swapfile --> Oops
>
> cat-ing /proc/swaps after the Oops will also give you
> Oops.
> tried it on 2.2.9 & 2.2.7 on machines where i don't have

The following patch should fix this problem with swapfile:

--- linux/mm/swapfile.c.orig Mon Jun 7 11:20:26 1999
+++ linux/mm/swapfile.c Mon Jun 7 11:30:09 1999
@@ -572,7 +572,7 @@
} else if (S_ISREG(swap_dentry->d_inode->i_mode)) {
error = -EBUSY;
for (i = 0 ; i < nr_swapfiles ; i++) {
- if (i == type)
+ if (i == type || !swap_info[i].swap_file)
continue;
if (swap_dentry->d_inode == swap_info[i].swap_file->d_inode)
goto bad_swap;

Regards
Andrzej

-- 
=======================================================================
  Andrzej M. Krzysztofowicz               ankry@mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Technical University of Gdansk

- 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/