[lc-checkins] CVS: linux/mm/comp_cache free.c,1.40,1.41 swapout.c,1.64,1.65
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-07-18 11:54:52
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache In directory usw-pr-cvs1:/tmp/cvs-serv21414/mm/comp_cache Modified Files: free.c swapout.c Log Message: Bug fixes o Fixed potential deadlock in comp_cache_use_address() when calling delete_from_swap_cache() with the virtual_swap_list locked. Cleanup o Cleanup in find_free_swp_buffer() Index: free.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/free.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -r1.40 -r1.41 *** free.c 17 Jul 2002 21:45:12 -0000 1.40 --- free.c 18 Jul 2002 11:54:48 -0000 1.41 *************** *** 2,6 **** * linux/mm/comp_cache/free.c * ! * Time-stamp: <2002-07-17 17:51:14 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/free.c * ! * Time-stamp: <2002-07-18 08:40:22 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 317,320 **** --- 317,329 ---- swap_duplicate(entry); } + + if (vswap->swap_cache_page) { + if (vswap->swap_count != 1) + BUG(); + } + else { + if (vswap->swap_count) + BUG(); + } /* let's fix swap cache page address (if any) */ *************** *** 327,333 **** page_cache_get(swap_cache_page); ! delete_from_swap_cache(swap_cache_page); ! if (add_to_swap_cache(swap_cache_page, entry)) ! BUG(); UnlockPage(swap_cache_page); --- 336,345 ---- page_cache_get(swap_cache_page); ! spin_lock(&pagecache_lock); ! __delete_from_swap_cache(swap_cache_page); ! spin_unlock(&pagecache_lock); ! virtual_swap_free(vswap->offset); ! ! add_to_swap_cache(swap_cache_page, entry); UnlockPage(swap_cache_page); Index: swapout.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapout.c,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -r1.64 -r1.65 *** swapout.c 17 Jul 2002 21:45:12 -0000 1.64 --- swapout.c 18 Jul 2002 11:54:48 -0000 1.65 *************** *** 2,6 **** * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-07-17 18:26:45 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-07-17 18:48:02 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 144,148 **** refill_swp_buffer(gfp_mask, priority--); ! /* Failed to get a free swap buffer. Probably gfp_mask does * not allow buffer sync in refill_swp_buffer() function. */ if (list_empty(&swp_free_buffer_head)) { --- 144,150 ---- refill_swp_buffer(gfp_mask, priority--); ! error = -ENOENT; ! ! /* Failed to get a free swap buffer. Probably gfp_mask does * not allow buffer sync in refill_swp_buffer() function. */ if (list_empty(&swp_free_buffer_head)) { *************** *** 153,157 **** /* Fragment totally freed. Free its struct to avoid leakage. */ if (!CompFragmentIO(fragment)) { - error = -ENOENT; kmem_cache_free(fragment_cachep, (fragment)); goto failed; --- 155,158 ---- *************** *** 159,166 **** /* Fragment partially freed (to be merged). Nothing to do. */ ! if (CompFragmentFreed(fragment)) { ! error = -ENOENT; goto failed; - } get_free_buffer: --- 160,165 ---- /* Fragment partially freed (to be merged). Nothing to do. */ ! if (CompFragmentFreed(fragment)) goto failed; get_free_buffer: |