Re: [RFC PATCH] fs/ntfs3: prevent positive E_NTFS_NONRESIDENT from reaching writeback error handling

Vidhu Sarwal <[email protected]> Sat, 25 Jul 2026 09:45:12 +0530
Newsgroups dev.linux.lists.ntfs3,dev.linux.lists.linux-kernel-mentees,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <CAFqz8LJLZ4c3qT9LWrW8BMVknrMtiRhJzwqa7VLQuxOMkJJr=A@mail.gmail.com>
On Thu, Jul 23, 2026 at 7:03 PM Jori Koolstra <[email protected]> wrote:
>
> Should attr_data_write_resident() be returning positive values on error?
> If this is correct, and this is a matter of data corruption you can use
> EFSCORRUPTED (EIO may also be fine if this is what NTFS uses in other
> places).

Yes. attr_data_write_resident() intentionally returns the positive
internal status code E_NTFS_NONRESIDENT when it detects that the DATA
attribute has become non-resident. This is an ntfs3 specific
used internally to signal the transition rather than a standard errno.

The issue is that ntfs_writepages() propagates this internal status into
the generic writeback error handling without translating it first. The
MM writeback code expects either 0 or a negative errno, so the positive
value triggers the WARN_ON_ONCE(*error > 0).

I chose -EIO because this is not filesystem metadata corruption. The
race is between is_resident() and attr_make_nonresident(), leaving the
filesystem in a valid state but causing an internal status code to
escape outside ntfs3. I think EFSCORRUPTED would imply metadata
corruption, which didnt happen here.

Thanks,
Vidhu