mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v12 0/6] ntfs: fix volume flag races and persist the recorded error state
@ 2026-09-14  8:37 Hongling Zeng
  2026-09-14  8:37 ` [PATCH v12 1/6] ntfs: fix volume flag update races Hongling Zeng
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Hongling Zeng @ 2026-09-14  8:37 UTC (permalink / raw)
  To: linkinjeon, hyc.lee; +Cc: ntfs, linux-kernel, zhongling0719, Hongling Zeng

Hi all,

The fs/ntfs runtime metadata-corruption paths only record the in-memory
NVolErrors() flag, and the dirty-bit persistence used to race with
ntfs_sync_fs(): a volume could end up with a clean on-disk dirty flag
despite modification or recorded corruption, so chkdsk would not run on
the next mount.  This series fixes that.

   1/6 makes the volume flag read-modify-write atomic under the
      $Volume mrec_lock;
   2/6 marks the volume dirty unconditionally on metadata changes,
      dropping the racy caller-side checks in file.c and namei.c;
   3/6 derives the on-disk dirty bit from the recorded error state at
      the persistence points (sync_fs, remount-ro, put_super) and never
      writes a hibernated volume;
   4/6 persists the dirty state after the final put_super() commits so
      late errors cannot unmount clean;
   5/6 stops ntfs_sync_fs() from clearing VOLUME_IS_DIRTY: the clearing
      moves to the quiescent transitions, a recorded error state is
      still persisted at sync time, and sync now reports writeback and
      flush errors instead of discarding them;
   6/6 checks the dirty-state commit on remount and unmount.

Changes in this revision, from the review:

  - 5/6: with the clearing gone from the sync path, a recorded error
    state is persisted without ever clearing the bit, and
    sync_blockdev() and blkdev_issue_flush() are both called with the
    first error returned.

  - The IOCB_NOWAIT behavior and the per-operation $Volume mrec_lock
    acquisition are outside the scope of this series.  The series keeps
    the unconditional ntfs_set_volume_flags() call to preserve the
    ordering that marks the volume dirty before the metadata
    modification; a RWF_NOWAIT write still blocks in the marking when
    the volume looks clean, as it already did on the base.  The
    non-blocking and contended-lock handling (mutex_trylock, GFP_NOWAIT)
    will be addressed in a separate follow-up patch.

Hongling Zeng (4):
  ntfs: fix volume flag update races
  ntfs: set the volume dirty bit unconditionally on metadata changes
  ntfs: sync the volume dirty bit with the recorded error state
  ntfs: persist the dirty state after the final put_super() commits

 fs/ntfs/file.c   |  20 ++---
 fs/ntfs/namei.c  |  24 ++----
 fs/ntfs/ntfs.h   |   1 -
 fs/ntfs/super.c  | 191 ++++++++++++++++++++++++++++++++++++-----------
 fs/ntfs/volume.h |   4 +
 5 files changed, 171 insertions(+), 69 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-09-15  6:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14  8:37 [PATCH v12 0/6] ntfs: fix volume flag races and persist the recorded error state Hongling Zeng
2026-09-14  8:37 ` [PATCH v12 1/6] ntfs: fix volume flag update races Hongling Zeng
2026-09-14  8:37 ` [PATCH v12 2/6] ntfs: set the volume dirty bit unconditionally on metadata changes Hongling Zeng
2026-09-14  8:37 ` [PATCH v12 3/6] ntfs: sync the volume dirty bit with the recorded error state Hongling Zeng
2026-09-14  8:37 ` [PATCH v12 4/6] ntfs: persist the dirty state after the final put_super() commits Hongling Zeng
2026-09-14  8:37 ` [PATCH v12 5/6] ntfs: do not clear the volume dirty bit during sync Hongling Zeng
2026-09-14  8:37 ` [PATCH v12 6/6] ntfs: check the dirty-state commit on remount and unmount Hongling Zeng
2026-09-15  5:38   ` Hyunchul Lee
2026-09-15  6:58     ` dd

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®