Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B52BC6FD18 for ; Tue, 28 Mar 2023 13:52:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231976AbjC1Nwl (ORCPT ); Tue, 28 Mar 2023 09:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231424AbjC1Nwk (ORCPT ); Tue, 28 Mar 2023 09:52:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2466E40EE for ; Tue, 28 Mar 2023 06:52:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AFFAA617A7 for ; Tue, 28 Mar 2023 13:52:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC609C433EF; Tue, 28 Mar 2023 13:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680011559; bh=QThtAYBctl4ZF0TdOu9mqdLeJgeOJlgbh5jK+mftH7w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=y8VIIhD/uhmI4tJx87Zn9eA+rSZ+UkpvsvrVaL/U9Yu48iZ5FbJR5t5oHQ9xykVnc jzQo8LGE8W0Zx0iJbmse0OPoLFF+FRJ6w9nIU/+zy0Ugl3w81ffK6D/KK9zfAwfQWn fmK3adf1yeMvCzFjhruJVzWbHJXDZbp9HpEhLpsg= Date: Tue, 28 Mar 2023 15:52:35 +0200 From: Greg KH To: Joseph Qi Cc: stable@vger.kernel.org, Jan Kara via Ocfs2-devel , Jan Kara , Mark Fasheh , Joel Becker , Junxiao Bi , Changwei Ge , Gang He , Jun Piao , Andrew Morton Subject: Re: [PATCH] ocfs2: fix data corruption after failed write Message-ID: References: <16793134471133@kroah.com> <20230321032024.165992-1-joseph.qi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230321032024.165992-1-joseph.qi@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Tue, Mar 21, 2023 at 11:20:24AM +0800, Joseph Qi wrote: > From: Jan Kara via Ocfs2-devel > > 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@suse.cz > Fixes: 6dbf7bb55598 ("fs: Don't invalidate page buffers in block_write_full_page()") > Signed-off-by: Jan Kara > Reviewed-by: Joseph Qi > Cc: Mark Fasheh > Cc: Joel Becker > Cc: Junxiao Bi > Cc: Changwei Ge > Cc: Gang He > Cc: Jun Piao > Cc: > Signed-off-by: Andrew Morton > [ replace block_invalidate_folio to block_invalidatepage ] > Signed-off-by: Joseph Qi > --- > fs/ocfs2/aops.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > Now queued up, thanks. greg k-h