Joseph Qi
2023-Mar-21 02:06 UTC
[Ocfs2-devel] FAILED: patch "[PATCH] ocfs2: fix data corruption after failed write" failed to apply to 5.10-stable tree
Hi Greg, It can be cleanly applied for linux-5.10.y and linux-4.19.y in my desktop. I'm not sure how it happens. Thanks, Joseph On 3/20/23 7:57 PM, gregkh--- via Ocfs2-devel wrote:> > The patch below does not apply to the 5.10-stable tree. > If someone wants it applied there, or to any other stable or longterm > tree, then please email the backport, including the original git commit > id to <stable at vger.kernel.org>. > > To reproduce the conflict and resubmit, you may use the following commands: > > git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y > git checkout FETCH_HEAD > git cherry-pick -x 90410bcf873cf05f54a32183afff0161f44f9715 > # <resolve conflicts, build, test, etc.> > git commit -s > git send-email --to '<stable at vger.kernel.org>' --in-reply-to '1679313445246112 at kroah.com' --subject-prefix 'PATCH 5.10.y' HEAD^.. > > Possible dependencies: > > 90410bcf873c ("ocfs2: fix data corruption after failed write") > > thanks, > > greg k-h > > ------------------ original commit in Linus's tree ------------------ > > From 90410bcf873cf05f54a32183afff0161f44f9715 Mon Sep 17 00:00:00 2001 > From: Jan Kara via Ocfs2-devel <ocfs2-devel at oss.oracle.com> > Date: Thu, 2 Mar 2023 16:38:43 +0100 > Subject: [PATCH] ocfs2: fix data corruption after failed write > > 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 at suse.cz > Fixes: 6dbf7bb55598 ("fs: Don't invalidate page buffers in block_write_full_page()") > Signed-off-by: Jan Kara <jack at suse.cz> > Reviewed-by: Joseph Qi <joseph.qi at linux.alibaba.com> > Cc: Mark Fasheh <mark at fasheh.com> > Cc: Joel Becker <jlbec at evilplan.org> > Cc: Junxiao Bi <junxiao.bi at oracle.com> > Cc: Changwei Ge <gechangwei at live.cn> > Cc: Gang He <ghe at suse.com> > Cc: Jun Piao <piaojun at huawei.com> > Cc: <stable at vger.kernel.org> > Signed-off-by: Andrew Morton <akpm at linux-foundation.org> > > diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c > index 1d65f6ef00ca..0394505fdce3 100644 > --- a/fs/ocfs2/aops.c > +++ b/fs/ocfs2/aops.c > @@ -1977,11 +1977,26 @@ int ocfs2_write_end_nolock(struct address_space *mapping, > } > > if (unlikely(copied < len) && wc->w_target_page) { > + loff_t new_isize; > + > if (!PageUptodate(wc->w_target_page)) > copied = 0; > > - ocfs2_zero_new_buffers(wc->w_target_page, start+copied, > - start+len); > + new_isize = max_t(loff_t, i_size_read(inode), pos + copied); > + if (new_isize > page_offset(wc->w_target_page)) > + ocfs2_zero_new_buffers(wc->w_target_page, start+copied, > + start+len); > + else { > + /* > + * When page is fully beyond new isize (data copy > + * failed), do not bother zeroing the page. Invalidate > + * it instead so that writeback does not get confused > + * put page & buffer dirty bits into inconsistent > + * state. > + */ > + block_invalidate_folio(page_folio(wc->w_target_page), > + 0, PAGE_SIZE); > + } > } > if (wc->w_target_page) > flush_dcache_page(wc->w_target_page); > > > _______________________________________________ > Ocfs2-devel mailing list > Ocfs2-devel at oss.oracle.com > https://oss.oracle.com/mailman/listinfo/ocfs2-devel
Bagas Sanjaya
2023-Mar-21 02:13 UTC
[Ocfs2-devel] FAILED: patch "[PATCH] ocfs2: fix data corruption after failed write" failed to apply to 5.10-stable tree
On Tue, Mar 21, 2023 at 10:06:30AM +0800, Joseph Qi wrote:> Hi Greg, > It can be cleanly applied for linux-5.10.y and linux-4.19.y in my desktop. > I'm not sure how it happens. >If you can apply the backport, why don't you post it here? -- An old man doll... just what I always wanted! - Clara -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 228 bytes Desc: not available URL: <http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20230321/9471d0c2/attachment-0001.sig>
Joseph Qi
2023-Mar-21 02:21 UTC
[Ocfs2-devel] FAILED: patch "[PATCH] ocfs2: fix data corruption after failed write" failed to apply to 5.10-stable tree
On 3/21/23 10:13 AM, Bagas Sanjaya wrote:> On Tue, Mar 21, 2023 at 10:06:30AM +0800, Joseph Qi wrote: >> Hi Greg, >> It can be cleanly applied for linux-5.10.y and linux-4.19.y in my desktop. >> I'm not sure how it happens. >> > > If you can apply the backport, why don't you post it here? >My mistake, it requires feature folio. Will adapt and post it later. Thanks, Joseph
Seemingly Similar Threads
- FAILED: patch "[PATCH] ocfs2: fix data corruption after failed write" failed to apply to 5.10-stable tree
- FAILED: patch "[PATCH] ocfs2: fix data corruption after failed write" failed to apply to 4.19-stable tree
- Patch "ocfs2: fix data corruption after failed write" has been added to the 5.10-stable tree
- Patch "ocfs2: fix use-after-free when unmounting read-only filesystem" has been added to the 5.10-stable tree
- Patch "ocfs2: fix use-after-free when unmounting read-only filesystem" has been added to the 4.19-stable tree