Re: [PATCH][2.6] No swapping on memory backed swapfiles

From: Zwane Mwaikambo
Date: Mon Oct 13 2003 - 04:36:34 EST


On Mon, 13 Oct 2003, Andrew Morton wrote:

> A non-memory-backed fs may still have a NULL ->readpage though (ncpfs?).
>
> I do think it best to just test for ->readpage, and give the user the extra
> rope.

Ok, here we go;

Index: linux-2.6.0-test7/mm/swapfile.c
===================================================================
RCS file: /build/cvsroot/linux-2.6.0-test7/mm/swapfile.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 swapfile.c
--- linux-2.6.0-test7/mm/swapfile.c 9 Oct 2003 05:56:12 -0000 1.1.1.1
+++ linux-2.6.0-test7/mm/swapfile.c 13 Oct 2003 09:23:31 -0000
@@ -1318,6 +1318,10 @@ asmlinkage long sys_swapon(const char __
/*
* Read the swap header.
*/
+ if (!mapping->a_ops->readpage) {
+ error = -EIO;
+ goto bad_swap;
+ }
page = read_cache_page(mapping, 0,
(filler_t *)mapping->a_ops->readpage, swap_file);
if (IS_ERR(page)) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/