Re: [PATCH] mm: cleancache: fix corruption on missed inode invalidation

From: Andrew Morton
Date: Thu Nov 15 2018 - 17:30:03 EST


On Mon, 12 Nov 2018 12:31:53 +0100 Jan Kara <jack@xxxxxxx> wrote:

> > mm/truncate.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> The patch looks good but can you add a short comment before the
> truncate_inode_pages() call explaining why it needs to be called always?
> Something like:
>
> /*
> * Cleancache needs notification even if there are no pages or
> * shadow entries...
> */

--- a/mm/truncate.c~mm-cleancache-fix-corruption-on-missed-inode-invalidation-fix
+++ a/mm/truncate.c
@@ -519,6 +519,10 @@ void truncate_inode_pages_final(struct a
xa_unlock_irq(&mapping->i_pages);
}

+ /*
+ * Cleancache needs notification even if there are no pages or shadow
+ * entries.
+ */
truncate_inode_pages(mapping, 0);
}
EXPORT_SYMBOL(truncate_inode_pages_final);
_