public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Tso" <tytso@mit.edu>
To: Deepanshu Kartikey <kartikey406@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Zhang Yi <yi.zhang@huaweicloud.com>,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+b0a0670332b6b3230a0a@syzkaller.appspotmail.com,
	adilger.kernel@dilger.ca, djwong@kernel.org
Subject: Re: [PATCH v2] ext4: check folio uptodate state in ext4_page_mkwrite()
Date: Thu, 4 Dec 2025 21:18:18 -0500	[thread overview]
Message-ID: <20251205021818.GF71988@macsyma.lan> (raw)
In-Reply-To: <CADhLXY4_yYdGQCYxq3=gQ6ZTJ7y_=dGsEBqdJ4g7JizX+ocVYA@mail.gmail.com>

On Thu, Dec 04, 2025 at 03:24:50PM +0530, Deepanshu Kartikey wrote:
> Based on Matthew's earlier feedback that we need to "prevent !uptodate
> folios from being referenced by the page tables," I believe the
> correct fix is not in ext4_page_mkwrite() at all, but rather in
> mpage_release_unused_pages().
> 
> When we invalidate folios due to writeback failure, we should also
> unmap them from page tables....

Hmm.... if the page is mmap'ed into the user process, on a writeback
failure, the page contents will suddenly and without any warning,
*disappear*.

So the other option is we could simply *not* invalidate the folio, but
instead leave the folio dirty.  In some cases, where a particular
block group is corrupted, if we retry the block allocation, the
corrupted block group will be busied out, and so when the write back
is retried, it's possible that the data will be actually be persisted.

We do need to make sure the right thing we unmount the filesystem,
since at that point, we have no choice but the invalidate the page and
the data will get lost when the file system is unmounted.  So it's a
more complicated approach.  But if this is happening when the file
system is corrupted, especially if it was maliciously corrupted, all
bets are off anyway, so maybe it's not worth the complexity.

     	     	     	      	       - Ted

  reply	other threads:[~2025-12-05  2:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-22  1:57 [PATCH v2] ext4: check folio uptodate state in ext4_page_mkwrite() Deepanshu Kartikey
2025-11-30  2:06 ` Deepanshu Kartikey
2025-12-02 12:24   ` Zhang Yi
2025-12-03  1:37     ` Deepanshu Kartikey
2025-12-03  6:52       ` Zhang Yi
2025-12-03  7:43         ` Deepanshu Kartikey
2025-12-03 15:46           ` Theodore Tso
2025-12-03 17:04             ` Deepanshu Kartikey
2025-12-03 18:40             ` Theodore Tso
2025-12-03 21:35             ` Matthew Wilcox
2025-12-03 22:33               ` Theodore Tso
2025-12-04  9:54                 ` Deepanshu Kartikey
2025-12-05  2:18                   ` Theodore Tso [this message]
2025-12-05  3:31                     ` Deepanshu Kartikey
2025-12-05  3:33                     ` Matthew Wilcox
2025-12-05 13:37                       ` Theodore Tso
2025-12-05 14:28                         ` Deepanshu Kartikey
2026-01-05  2:08                           ` Deepanshu Kartikey
2025-12-03 21:54             ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251205021818.GF71988@macsyma.lan \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=djwong@kernel.org \
    --cc=kartikey406@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+b0a0670332b6b3230a0a@syzkaller.appspotmail.com \
    --cc=willy@infradead.org \
    --cc=yi.zhang@huaweicloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox