[RHEL7,COMMIT] mm/tcache: Reset index before repeating invalidation

Submitted by Konstantin Khorenko on March 1, 2018, 8:54 a.m.

Details

Message ID 201803010854.w218sIMZ007891@finist_ce7.work
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko March 1, 2018, 8:54 a.m.
The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.45.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.17.1.vz7.45.6
------>
commit 050d50e22a9d4a782745b144f71b8d80d7edc719
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Thu Mar 1 11:54:17 2018 +0300

    mm/tcache: Reset index before repeating invalidation
    
    Commit 25176cdcdcc0 ("tcache: Fix race between tcache_invalidate_node()
            and tcache_attach_page()")
    removed reseting index before repeating invalidation. Essentially this
    broke repeat logic entirely as we retry invalidation past the end of
    the file.
    
    Reset index to zero before invalidation retry.
    
    https://jira.sw.ru/browse/PSBM-81760
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 mm/tcache.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/tcache.c b/mm/tcache.c
index 6e0c10dd3339..31a9eb3d1e12 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -918,7 +918,7 @@  tcache_invalidate_node_pages(struct tcache_node *node)
 	bool repeat, synchronize_sched_once = true;
 	pgoff_t indices[TCACHE_PAGEVEC_SIZE];
 	struct page *pages[TCACHE_PAGEVEC_SIZE];
-	pgoff_t index = 0;
+	pgoff_t index;
 	unsigned nr_pages;
 	int i;
 
@@ -926,6 +926,7 @@  tcache_invalidate_node_pages(struct tcache_node *node)
 	 * First forbid new page insertions - see tcache_page_tree_replace.
 	 */
 again:
+	index = 0;
 	repeat = false;
 	while ((nr_pages = tcache_lookup(pages, node, index,
 						TCACHE_PAGEVEC_SIZE, indices))) {