patch-2.0.1 linux/mm/swapfile.c

Next file: linux/mm/vmscan.c
Previous file: linux/mm/mremap.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.0/linux/mm/swapfile.c linux/mm/swapfile.c
@@ -16,6 +16,7 @@
 #include <linux/swap.h>
 #include <linux/fs.h>
 #include <linux/swapctl.h>
+#include <linux/blkdev.h> /* for blk_size */
 
 #include <asm/dma.h>
 #include <asm/system.h> /* for cli()/sti() */
@@ -457,7 +458,9 @@
 		if(error)
 			goto bad_swap_2;
 		error = -ENODEV;
-		if (!p->swap_device)
+		if (!p->swap_device ||
+		    (blk_size[MAJOR(p->swap_device)] &&
+		     !blk_size[MAJOR(p->swap_device)][MINOR(p->swap_device)]))
 			goto bad_swap;
 		error = -EBUSY;
 		for (i = 0 ; i < nr_swapfiles ; i++) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov