Re: [PATCH v2] fat: skip rename rollback on buffers with failed I/O

From: Krystian Kaniewski

Date: Wed Oct 14 2026 - 04:30:13 EST


On 10/11/26 20:36, OGAWA Hirofumi wrote:
> Krystian Kaniewski <krystianmkaniewski@xxxxxxxxx> writes:
>
> Is this trying to revert as many as possible even if partial? If so, it
> would not help actually, and complex. Maybe we can give up whole if
> partially revert?
>
> Thanks.

Yes, v2 tried to roll back every part that did not share the buffer with
the failed write. I agree that this may only produce a partial rollback
once the rename has progressed past a failed ".." update or old-entry
removal, and the alias tracking makes the error path too complex.

I have reworked this for v3. After either of those failures, the code now
gives up the on-disk rollback entirely, restores only the in-memory state,
reports filesystem corruption through fat_fs_error(), and returns the
original error.

The remaining on-disk recovery is limited to an earlier inode-position
write failure, before any ".." update or old-entry removal. At that point
a complete rollback is still possible by rereading the retained new-entry
buffer or reacquiring the entry buffer through inode writeback. For
RENAME_EXCHANGE, both position restorations are attempted because stopping
after the first failed restoration can leave both names pointing to the
same inode.

Thanks for the suggestion. I have tried to address it in v3 and will send
the revised patch shortly.
--
Krystian Kaniewski