Re: [PATCH] ntfs: don't let a fatal signal interrupt metadata reads
From: xkeyC
Date: Wed Nov 11 2026 - 22:29:43 EST
Hi Hyunchul,
Thanks for the review.
On Mon, Nov 09, 2026 at 11:05:55AM +0900, Hyunchul Lee wrote:
> Could you double-check the Fixes tag and Could you confirm that
> xkeyC is your known identify for the sign-off?
You're right, the Fixes tags were incomplete. The directory index lookup
in ntfs_lookup_inode_by_name() comes from 0a8ac0c1fa0b ("ntfs: update
directory operations") and ntfs_bdev_write() from 5218cd102aec ("ntfs:
update misc operations"). v2 adds them, plus the commits behind the
mount-time reads that v2 also converts (see below).
Yes, xkeyC is my known identity. This is my first contribution to the
kernel. I use the name xkeyC everywhere online, for example
https://github.com/xkeyC and https://huggingface.co/xkeyC, and it
identifies only me, so I would like to keep signing off with it.
> The read when writing to non-resident stream should remain
> interruptible.
Agreed. v2 keeps that read killable for named streams, as
ntfs_inode_attr_pread() does, and does not call ntfs_error() when it
fails with -EINTR, so an interrupted stream write no longer turns the
volume read-only either. I added a test for it to the reproducers.
Without the patch, an NTFS_IOC_STREAM_WRITE killed partway through made
the volume read-only on the first run:
__ntfs_inode_non_resident_attr_pwrite(): Failed to read a page 6 for attr 0x80: -4
With v2 it stayed read-write in 20 runs.
> Other paths still using interruptible reads include $LogFile and
> $MFTMirr checks, $AttrDef and $Upcase loading, bitmap scans through
> ntfs_get_locked_folio(), and ntfs_bitmap_check_used().
Thanks for listing them. I had left the mount-time reads alone on
purpose, but an interrupted read there is not harmless either. Killing
mount partway through made it fail in all 20 runs, with bogus "Failed to
load $UpCase from the volume" and "Failed to initialize attribute
definition table" errors. From the code, an interrupted read in
check_mft_mirror(), the hibernation check or load_and_check_badclus()
would instead mount the volume read-only with a $MFTMirr or $BadClus
error. My tests did not hit those. v2 converts the $LogFile, $MFTMirr,
hiberfil.sys, $AttrDef, $UpCase and ntfs_bitmap_check_used() reads too,
and with it the killed mount succeeded read-write in all 20 runs.
I kept the bitmap scans through ntfs_get_locked_folio() as they are.
They only read, and their callers (free cluster and MFT record counting,
and FITRIM) skip the page or return the error without calling
ntfs_error(). FITRIM can walk a large part of the bitmap, so it should
stay killable.
I'll send v2 shortly.
Thanks,
xkeyC