[PATCH] fixes for swap-file 2.2.2pre/2.2.1-ac

Andrzej Krzysztofowicz (ankry@green.mif.pg.gda.pl)
Mon, 22 Feb 1999 19:44:41 +0100 (CET)


Hi,
I enclose a patch against 2.2.2pre5 (or 2.2.1-ac6 as well) which fixes:

1. proper swap-file locking: it was possible to swapon twice the same file
if it existed as two hardlinked directory entries
[ It was broken some time ago by dentry code; it works OK in 2.0 ]

2. (cosmetic) avoid decreasing swap priority when sys_swapon fails for
any reason.

Andrzej

***************** PATCH SWAP *******************************************
--- linux/mm/swapfile.c.old Thu Jan 14 18:54:22 1999
+++ linux/mm/swapfile.c Sun Feb 7 11:39:10 1999
@@ -556,7 +556,7 @@
for (i = 0 ; i < nr_swapfiles ; i++) {
if (i == type)
continue;
- if (p->swap_file == swap_info[i].swap_file)
+ if (swap_dentry->d_inode == swap_info[i].swap_file->d_inode)
goto bad_swap;
}
} else
@@ -701,6 +701,8 @@
p->swap_map = NULL;
p->swap_lockmap = NULL;
p->flags = 0;
+ if (!(swap_flags & SWAP_FLAG_PREFER))
+ ++least_priority;
out:
if (swap_header)
free_page((long) swap_header);
******************************************************************************

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