On Tue, Mar 21, 2023 at 11:20:24AM +0800, Joseph Qi wrote: > From: Jan Kara via Ocfs2-devel <ocfs2-devel@xxxxxxxxxxxxxx> > > commit 90410bcf873cf05f54a32183afff0161f44f9715 upstream. > > When buffered write fails to copy data into underlying page cache page, > ocfs2_write_end_nolock() just zeroes out and dirties the page. This can > leave dirty page beyond EOF and if page writeback tries to write this page > before write succeeds and expands i_size, page gets into inconsistent > state where page dirty bit is clear but buffer dirty bits stay set > resulting in page data never getting written and so data copied to the > page is lost. Fix the problem by invalidating page beyond EOF after > failed write. > > Link: https://lkml.kernel.org/r/20230302153843.18499-1-jack@xxxxxxx > Fixes: 6dbf7bb55598 ("fs: Don't invalidate page buffers in block_write_full_page()") > Signed-off-by: Jan Kara <jack@xxxxxxx> > Reviewed-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx> > Cc: Mark Fasheh <mark@xxxxxxxxxx> > Cc: Joel Becker <jlbec@xxxxxxxxxxxx> > Cc: Junxiao Bi <junxiao.bi@xxxxxxxxxx> > Cc: Changwei Ge <gechangwei@xxxxxxx> > Cc: Gang He <ghe@xxxxxxxx> > Cc: Jun Piao <piaojun@xxxxxxxxxx> > Cc: <stable@xxxxxxxxxxxxxxx> > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > [ replace block_invalidate_folio to block_invalidatepage ] > Signed-off-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx> > --- > fs/ocfs2/aops.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > Now queued up, thanks. greg k-h