mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Krystian Kaniewski <krystianmkaniewski@gmail.com>
Cc: linux-kernel@vger.kernel.org,  linux-fsdevel@vger.kernel.org,
	syzbot+b0aebd03565f5774f7f8@syzkaller.appspotmail.com
Subject: Re: [PATCH v3] fat: make rename recovery safe after metadata write errors
Date: Sat, 17 Oct 2026 00:23:47 +0900	[thread overview]
Message-ID: <875wz11xfg.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <f9b27432-4104-4323-8cd7-e2cda73db2f9@gmail.com>

Krystian Kaniewski <krystianmkaniewski@gmail.com> writes:

> On 10/16/26 15:50, OGAWA Hirofumi wrote:
>> Krystian Kaniewski <krystianmkaniewski@gmail.com> writes:
>> 
>>> On 10/15/26 20:54, OGAWA Hirofumi wrote:
>>>
>>>>> +	} else if (!rollback_err) {
>>>>> +		/* Read the entry block again if a failed write invalidated it. */
>>>>> +		rollback_err = bh_read(sinfo.bh, 0);
>>>>
>>>> Why do this read the bh from on disk?
>>>>
>>>
>>> The bh_read(sinfo.bh, 0) is needed because a failed inode-position write clears BH_Uptodate. fat_remove_entries() modifies and dirties that retained buffer directly, which otherwise triggers the warning. Reading it first refreshes the whole block. If the read fails, the buffer is left untouched.
>>>
>>> The same reasoning applies to both the VFAT and MS-DOS paths.
>> 
>> If sinfo.bh is required to read because of failure of I/O error, I guess
>> the bh will fail to write again. I think we should give up to rollback
>> in that case.
>> 
>> Thanks.
>
> Thanks. I was trying to handle transient errors here. The old entry still exists at this point, so if the read and removal succeed, the rename can be fully rolled back.
>
> In my tests with a single injected write error, giving up left the new entry pointing at the root directory, and fsck.fat wanted to remove it. Retrying the cleanup left the filesystem clean. If either the read or the cleanup write fails, we stop and report corruption anyway.
>
> Do you still think we should give up here? If you prefer not to retry the new-entry block after its failed write, should we also avoid rereading and rewriting dotdot_bh after a failed .. update?

Basically that path is not the failure of sinfo.bh, true? If so, we will
not need to re-read sinfo.bh here, just removing the added entries would
be ok. 

If we have to read sinfo.bh, the sinfo.bh may be failed the write and
cleared the uptodate. If so, I wonder why succeed by retry?

The above is my understand.

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

      reply	other threads:[~2026-10-16 15:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 16:38 [syzbot] [exfat?] WARNING in vfat_update_dotdot_de syzbot
2026-09-29  9:00 ` [PATCH] fat: validate dotdot buffers in VFAT and MSDOS rename and rollback Krystian Kaniewski
2026-09-30  8:02   ` OGAWA Hirofumi
2026-09-30 12:17     ` Krystian Kaniewski
2026-10-02 13:43     ` [PATCH v2] fat: skip rename rollback on buffers with failed I/O Krystian Kaniewski
2026-10-11 18:36       ` OGAWA Hirofumi
2026-10-14  8:21         ` Krystian Kaniewski
2026-10-14  8:23         ` [PATCH v3] fat: make rename recovery safe after metadata write errors Krystian Kaniewski
2026-10-15 18:54           ` OGAWA Hirofumi
2026-10-16 13:30             ` Krystian Kaniewski
2026-10-16 13:50               ` OGAWA Hirofumi
2026-10-16 14:01                 ` Krystian Kaniewski
2026-10-16 15:23                   ` OGAWA Hirofumi [this message]

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=875wz11xfg.fsf@mail.parknet.co.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=krystianmkaniewski@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+b0aebd03565f5774f7f8@syzkaller.appspotmail.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®