patch-2.1.43 linux/mm/swapfile.c

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

diff -u --recursive --new-file v2.1.42/linux/mm/swapfile.c linux/mm/swapfile.c
@@ -176,14 +176,16 @@
 	if (pte_none(pte))
 		return 0;
 	if (pte_present(pte)) {
+		struct page *pg;
 		unsigned long page_nr = MAP_NR(pte_page(pte));
 		if (page_nr >= max_mapnr)
 			return 0;
-		if (!in_swap_cache(page_nr))
+		pg = mem_map + page_nr;
+		if (!in_swap_cache(pg))
 			return 0;
-		if (SWP_TYPE(in_swap_cache(page_nr)) != type)
+		if (SWP_TYPE(in_swap_cache(pg)) != type)
 			return 0;
-		delete_from_swap_cache(page_nr);
+		delete_from_swap_cache(pg);
 		set_pte(dir, pte_mkdirty(pte));
 		return 0;
 	}
@@ -332,7 +334,7 @@
 	lock_kernel();
 	if (!suser())
 		goto out;
-	err = namei(specialfile,&inode);
+	err = namei(NAM_FOLLOW_LINK, specialfile, &inode);
 	if (err)
 		goto out;
 	prev = -1;
@@ -486,12 +488,12 @@
 	} else {
 		p->prio = --least_priority;
 	}
-	error = namei(specialfile,&swap_inode);
+	error = namei(NAM_FOLLOW_LINK, specialfile, &swap_inode);
 	if (error)
 		goto bad_swap_2;
 	p->swap_file = swap_inode;
 	error = -EBUSY;
-	if (swap_inode->i_count != 1)
+	if (atomic_read(&swap_inode->i_count) != 1)
 		goto bad_swap_2;
 	error = -EINVAL;
 

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