[PATCH RFC 14/28] ntfs: don't set SB_RDONLY after filesystem errors
Christian Brauner
brauner at kernel.org
Wed Oct 28 09:05:06 PDT 2026
On Mon, Oct 19, 2026 at 03:14:46PM +0900, Hyunchul Lee wrote:
> Before this patch, SB_RDONLY is set, so remount,rw returned -EROFS. With
> this patch, sb_rdonly(sb) is false, so remount,rw skips the check and
> return success even though writes are rejected with -EROFS.
Yes, that's intended. ntfs_reconfigure() only refuses the transition
from ro to rw. After an error with errors=remount-ro
ntfs_handle_error() sets NV_Errors and NV_EmergencyRO. A remount to
read-only works and a remount to read-write after that fails with
-EROFS. A "mount -o remount,rw" of a volume that is still read-write
isn't a transition. It returns 0 but doesn't change anything.
That's how ext4 behaves since commit d3476f3dad4a ("ext4: don't set
SB_RDONLY after filesystem errors"). __ext4_remount() only looks at
ext4_emergency_state() if the read-only state changes. And every other
filesystem in this series does the same.
> I think that the condition should be test NVolErrors(), for example
>
> if ((sb_rdonly(sb) || NVolErrors(vol)) &&
> !(fc->sb_flags & SB_RDONLY)) {
NV_Errors is the wrong bit for this. It's also set outside of
ntfs_handle_error() no matter what errors= says. map_mft_record_folio()
sets it when an mft record fails its checks and ntfs_read_locked_inode()
when it marks an inode bad. So with errors=continue (which is the
default?) a single corrupt mft record leaves NV_Errors set on a volume that is
still writable.
With your change every remount that keeps such a volume read-write, e.g. just
to change another option, would fail with "Volume has errors and is read-only".
If you really want ntfs to refuse remount,rw in the emergency state then
NVolEmergencyRO() is the bit to test. But then ntfs would behave
differently from ext4 and the rest of this series. So I'd rather keep it
as is.
Fwiw, in the next version reconfigure_super() refuses the transition to
read-write itself. It uses the generic emergency read-only state Jan asked for.
More information about the linux-mtd
mailing list