[Devel] [PATCH RHEL7 COMMIT] mm/frontswap: invalidate expired data on a dup-store failure

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 22 02:37:46 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.15
------>
commit cb5f08649a6b2fcc162401cbb2c0f4ffc8d58f0a
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Mon Jun 22 13:37:46 2015 +0400

    mm/frontswap: invalidate expired data on a dup-store failure
    
    Patchset description:
    
    Patches 1 and 2 fix memory corruption caused by tswap:
      https://jira.sw.ru/browse/PSBM-34269
    Patch 5 fixes pinning a page in tswap.
    Patch 7 fixes indefinitely long stalls during tswap reclaim.
    Patch 3, 4, and 6 do cleanup.
    
    Vladimir Davydov (6):
      tswap: enable exclusive gets
      tswap: do not allocate a page on store if there is already one
      tswap: introduce tswap_delete_page helper
      tswap: shrink tswap page if swapcache page is uptodate
      tswap: use global lock to protect lru lists
      tswap: do not writeback pages on reclaim
    
    Weijie Yang (1):
      mm: frontswap: invalidate expired data on a dup-store failure
    
    ###############################################################
    This patch description:
    
    From: Weijie Yang <weijie.yang at samsung.com>
    
    If a frontswap dup-store failed, it should invalidate the expired page
    in the backend, or it could trigger some data corruption issue.
    Such as:
     1. use zswap as the frontswap backend with writeback feature
     2. store a swap page(version_1) to entry A, success
     3. dup-store a newer page(version_2) to the same entry A, fail
     4. use __swap_writepage() write version_2 page to swapfile, success
     5. zswap do shrink, writeback version_1 page to swapfile
     6. version_2 page is overwrited by version_1, data corrupt.
    
    This patch fixes this issue by invalidating expired data immediately
    when meet a dup-store failure.
    
    Signed-off-by: Weijie Yang <weijie.yang at samsung.com>
    Cc: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
    Cc: Seth Jennings <sjennings at variantweb.net>
    Cc: Dan Streetman <ddstreet at ieee.org>
    Cc: Minchan Kim <minchan at kernel.org>
    Cc: Bob Liu <bob.liu at oracle.com>
    Cc: <stable at vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
    
    https://jira.sw.ru/browse/PSBM-34269
    
    (cherry picked from commit fb993fa1a2f669215fa03a09eed7848f2663e336)
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 mm/frontswap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/frontswap.c b/mm/frontswap.c
index 1b24bdc..a55036a 100644
--- a/mm/frontswap.c
+++ b/mm/frontswap.c
@@ -244,8 +244,10 @@ int __frontswap_store(struct page *page)
 		  the (older) page from frontswap
 		 */
 		inc_frontswap_failed_stores();
-		if (dup)
+		if (dup) {
 			__frontswap_clear(sis, offset);
+			frontswap_ops->invalidate_page(type, offset);
+		}
 	}
 	if (frontswap_writethrough_enabled)
 		/* report failure so swap also writes to swap device */



More information about the Devel mailing list