[Devel] [PATCH RHEL7 COMMIT] mm/tswap: Add a sanity check in tswap_frontswap_store() on deleting a page

Konstantin Khorenko khorenko at virtuozzo.com
Tue Apr 26 16:37:01 MSK 2022


The commit is pushed to "branch-rh7-3.10.0-1160.59.1.vz7.186.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.59.1.vz7.186.2
------>
commit 8b86220f51f978f157f9fb4008169e5c9b7640cf
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Tue Apr 26 16:32:33 2022 +0300

    mm/tswap: Add a sanity check in tswap_frontswap_store() on deleting a page
    
    tswap_insert_page() is called in tswap_frontswap_store() only
    thus it's highly unluckely we ever race 2 tswap_frontswap_store() in
    parallel for the same page,
    
    but it's never too many sanity checks, so let's ask tswap_delete_page()
    to double check it is going to delete exactly the expected page.
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 mm/tswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/tswap.c b/mm/tswap.c
index 07d92a0c86cc..e4aa2854ede3 100644
--- a/mm/tswap.c
+++ b/mm/tswap.c
@@ -335,7 +335,7 @@ static int tswap_frontswap_store(unsigned type, pgoff_t offset,
 		/* If type of page has not changed, just reuse it */
 		if (zero_filled == (cache_page == ZERO_PAGE(0)))
 			goto copy;
-		tswap_delete_page(entry, NULL);
+		tswap_delete_page(entry, cache_page);
 		put_page(cache_page);
 	}
 


More information about the Devel mailing list