Skip to content

ntfs: fix quota out-of-date marking

DaeMyung Kang linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ntfs: return view index entry data from lookupfs/ntfs/index.c fs/ntfs/index.h+73 -51 reply
2/3ntfs: use $Q when marking quotas out of datefs/ntfs/quota.c+2 -11 reply
3/3ntfs: mark quotas out of date on initial rw mountfs/ntfs/super.c+35 -116 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchHyunchul Lee
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] ntfs: fix quota out-of-date marking

This series fixes NTFS quota out-of-date marking in fs/ntfs.

The driver already has quota compatibility code: it loads FILE_Extend/$Quota, opens the $Q index, and has ntfs_mark_quotas_out_of_date() to set QUOTA_FLAG_OUT_OF_DATE so Windows can rescan quota usage. The failures were not an intentional quota block; the code could not reach and update the $Quota/$Q defaults entry correctly.

Patch 1 fixes ntfs_index_lookup() so callers looking up view indexes get the index entry value instead of the key. Directory $I30 callers keep the existing key-return behavior. The patch uses the index root type, not the collation rule, to choose between $FILE_NAME keys and view-index values. It also validates the returned value bounds without truncating the minimum offset, excludes the child VCN tail from INDEX_ENTRY_NODE value ranges, and clears the returned context pointers before returning an invalid view-index entry error. The matched-entry data exposure and validation are moved into a small helper, ntfs_index_lookup_set_data(), so the done label stays flat and the bounds check has a single return.

Patch 2 fixes ntfs_mark_quotas_out_of_date() to look up $Quota/$Q by the $Q index name, not $I30.

Patch 3 calls ntfs_mark_quotas_out_of_date() during initial read-write mount as well as the existing read-only to read-write remount path. The init sequence is wrapped in a small helper, ntfs_init_quota_for_mount(), which captures each call result in a local variable, derives the failure reason, and gates the read-only downgrade on policy in one place — keeping ntfs_load_system_files() flat.

QEMU/virtme testing:

- The original remount-rw reproducer failed with:
"Lookup of quota defaults entry failed."
- After changing only the quota index name, the same path exposed the second bug and failed with:
"Quota defaults entry size is invalid. Run chkdsk."
- With this series applied:
- read-only mount followed by remount,rw succeeds
- with the $Quota/$Q defaults flags prepared as 0x00000011, remount,rw

    persists 0x00000211

- direct rw mount with the same prepared image also persists 0x00000211

DaeMyung Kang (3):
ntfs: return view index entry data from lookup
ntfs: use $Q when marking quotas out of date
ntfs: mark quotas out of date on initial rw mount

 fs/ntfs/index.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 fs/ntfs/index.h |  3 +-
 fs/ntfs/quota.c |  3 +-
 fs/ntfs/super.c | 46 ++++++++++++++++++++++++++--------
 4 files changed, 110 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0