mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chi Zhiling <chizhiling@163.com>
To: "Yuezhang.Mo@sony.com" <Yuezhang.Mo@sony.com>,
	"exfat@lists.linux.dev" <exfat@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "chenxiaosong@chenxiaosong.com" <chenxiaosong@chenxiaosong.com>,
	"dxdt@dev.snart.me" <dxdt@dev.snart.me>,
	"hyc.lee@gmail.com" <hyc.lee@gmail.com>,
	"linkinjeon@kernel.org" <linkinjeon@kernel.org>,
	"liubaolin12138@163.com" <liubaolin12138@163.com>,
	"sj1557.seo@samsung.com" <sj1557.seo@samsung.com>,
	Chi Zhiling <chizhiling@kylinos.cn>
Subject: Re: [PATCH v1 2/5] exfat: dirty all new pages when extending valid_size
Date: Wed, 30 Sep 2026 15:26:03 +0800	[thread overview]
Message-ID: <6c4a254e-5d3f-433d-80d9-ab243785d6cf@163.com> (raw)
In-Reply-To: <cf7a4ce8-1f64-4ab2-ac97-033f1a45438b@163.com>

On 9/30/26 2:16 PM, Chi Zhiling wrote:
> On 9/29/26 6:26 PM, Yuezhang.Mo@sony.com wrote:
>>> +               if (folio->mapping == mapping) {
>>>                          folio_mark_dirty(folio);
>>> +                       pos = next;
>>
>> Setting 'pos' under this condition may result in an infinite loop.
> 
> If we set pos unconditionally, I'm concerned that we might miss marking 
> a folio as dirty, which could expose stale data.
> 
> I think it would be better to switch to __filemap_get_folio() in the 
> next version. It can directly return a locked folio, so we don't need to 
> check whether the folio has been truncated.
> 
> folio = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN, 0);

Sorry, this change is incorrect.

I took another look at it, and I think this loop will not block. 
Reacquiring the folio is the correct approach, and do_read_cache_folio() 
performs the check in the same way.

> 
>>
>>> +               }
>>>                  folio_unlock(folio);
>>>                  folio_put(folio);
>>> -               pos = next;
>>>          }
>>>
>>>         return 0;
>>
> 


  reply	other threads:[~2026-09-30  7:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27  8:02 [PATCH v1 0/5] exfat: fix valid_size handling and locking Chi Zhiling
2026-09-27  8:03 ` [PATCH v1 1/5] exfat: advance valid_size to EOF for append writes Chi Zhiling
2026-09-27  8:03 ` [PATCH v1 2/5] exfat: dirty all new pages when extending valid_size Chi Zhiling
2026-09-29 10:26   ` Yuezhang.Mo
2026-09-30  6:16     ` Chi Zhiling
2026-09-30  7:26       ` Chi Zhiling [this message]
2026-09-27  8:03 ` [PATCH v1 3/5] exfat: hold the invalidate lock while truncating Chi Zhiling
2026-09-27  8:03 ` [PATCH v1 4/5] exfat: make valid_size and zeroed_size atomic Chi Zhiling
2026-09-27  8:03 ` [PATCH v1 5/5] exfat: use folio lock to protect valid_size Chi Zhiling
2026-09-30 10:01 ` [PATCH v1 0/5] exfat: fix valid_size handling and locking Namjae Jeon

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=6c4a254e-5d3f-433d-80d9-ab243785d6cf@163.com \
    --to=chizhiling@163.com \
    --cc=Yuezhang.Mo@sony.com \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=chizhiling@kylinos.cn \
    --cc=dxdt@dev.snart.me \
    --cc=exfat@lists.linux.dev \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubaolin12138@163.com \
    --cc=sj1557.seo@samsung.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

all inboxes | Powered by JetHome®