linux/fs/xfs/scrub
Darrick J. Wong ad4497a92c xfs: advance the findparent inode scan cursor while holding ILOCK
LOLLM pointed out a race condition in xrep_findparent_scan -- the
directory live update hook holds the directory ILOCK when it calls the
xchk_iscan_want_live_update predicate to figure out if it needs to
remember the live update, but xrep_findparent_scan drops the directory
ILOCK before advancing the cursor.  Therefore, it's possible for a live
update to check the scan cursor after the scan drops the ILOCK but
before the scan updates its cursor.  If this happens, we'll fail to
record the live update.  Fix this by moving the cursor update logic
inside xrep_findparent_walk_directory.

Note that for non-directories it's ok to advance the cursor without
holding any ILOCK because the findparent scan only cares about directory
parents, not the children.

Cc: stable@vger.kernel.org # v6.10
Fixes: a07b455762 ("xfs: scan the filesystem to repair a directory dotdot entry")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
History 2026-09-11 08:45:11 +02:00
..
agb_bitmap.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
agb_bitmap.h xfs: create agblock bitmap helper to count the number of set regions 2024-02-22 12:43:37 -08:00
agheader.c xfs: actually check internal-rtdev fields in the superblock 2026-09-11 08:43:24 +02:00
agheader_repair.c xfs: bail out on bitmap errors in xrep_agfl_fill 2026-09-10 16:26:37 +02:00
agino_bitmap.h xfs: repair AGI unlinked inode bucket lists 2024-04-15 14:58:58 -07:00
alloc.c xfs: only check mergeability of bnobt records 2026-08-03 10:17:34 +02:00
alloc_repair.c xfs: fix bnobt repair space reservation disposal failure 2026-09-07 07:50:36 +02:00
attr.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
attr.h xfs: repair extended attributes 2024-04-15 14:58:53 -07:00
attr_repair.c xfs: fix under-reservation of blocks when repairing sf directories 2026-09-11 08:37:30 +02:00
attr_repair.h xfs: actually rebuild the parent pointer xattrs 2024-04-23 16:55:15 -07:00
bitmap.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
bitmap.h xfs: create agblock bitmap helper to count the number of set regions 2024-02-22 12:43:37 -08:00
bmap.c xfs: fix termination logic in xchk_bmap 2026-09-11 08:44:16 +02:00
bmap_repair.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
btree.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
btree.h overflow: Add struct_size_t() helper 2023-05-26 13:52:19 -07:00
common.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
common.h xfs: remove several unused and never-implemented declarations 2026-09-07 08:21:54 +02:00
cow_repair.c xfs: move cow_replace_mapping to xfs_bmap_util.c 2026-07-14 11:01:47 +02:00
dab_bitmap.h xfs: create an xattr iteration function for scrub 2024-04-15 14:58:54 -07:00
dabtree.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
dabtree.h xfs: remove redundant function declaration 2026-09-10 16:26:36 +02:00
dir.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
dir_repair.c xfs: fix replaying dirent removals into the temporary directory 2026-09-11 08:44:35 +02:00
dirtree.c xfs: destroy seen inode bitmap when we fail to add a dirpath 2026-09-07 07:50:36 +02:00
dirtree.h xfs: refactor directory tree root predicates 2024-11-05 13:38:33 -08:00
dirtree_repair.c xfs: reset parent pointer args before each dir tree unlink repair 2026-09-11 08:44:48 +02:00
dqiterate.c xfs: don't wrap around quota ids in dqiterate 2026-07-14 11:01:47 +02:00
findparent.c xfs: advance the findparent inode scan cursor while holding ILOCK 2026-09-11 08:45:11 +02:00
findparent.h xfs: implement live updates for directory repairs 2024-04-23 16:55:13 -07:00
fsb_bitmap.h xfs: reintroduce reaping of file metadata blocks to xrep_reap_extents 2023-12-15 10:03:38 -08:00
fscounters.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
fscounters.h xfs: support RT inodes in xfs_mod_delalloc 2024-04-22 18:00:48 +05:30
fscounters_repair.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
health.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
health.h xfs: refactor the btree cursor allocation logic in xchk_ag_btcur_init 2024-02-22 12:39:48 -08:00
ialloc.c xfs: signal inode btree xref error if get_rec returns an error 2026-09-07 07:50:36 +02:00
ialloc_repair.c xfs: store an agbno in struct xfs_imap 2026-06-09 09:14:42 +02:00
ino_bitmap.h xfs: teach online scrub to find directory tree structure problems 2024-04-23 16:55:16 -07:00
inode.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
inode_repair.c xfs: fix inverted clearance of inode junk flags 2026-08-03 10:13:17 +02:00
iscan.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
iscan.h xfs: scan the filesystem to repair a directory dotdot entry 2024-04-15 14:58:56 -07:00
listxattr.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
listxattr.h xfs: add a per-leaf block callback to xchk_xattr_walk 2024-04-23 16:55:15 -07:00
metapath.c xfs: release alleged child inode on metapath unlink error 2026-09-07 07:50:35 +02:00
newbt.c xfs: add a xfs_rmap_inode_bmbt_owner 2026-06-09 09:14:41 +02:00
newbt.h xfs: support repairing metadata btrees rooted in metadir inodes 2024-12-23 13:06:08 -08:00
nlinks.c xfs: nlink scrub must take IOLOCK before determining ILOCK state 2026-08-03 10:17:34 +02:00
nlinks.h xfs: move files to orphanage instead of letting nlinks drop to zero 2024-04-15 14:58:57 -07:00
nlinks_repair.c xfs: zero i_nlink before repair puts inode on unlinked list 2026-07-22 15:06:25 +02:00
off_bitmap.h xfs: repair problems in CoW forks 2023-12-15 10:03:40 -08:00
orphanage.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
orphanage.h xfs: fix corruptions in the directory tree 2024-04-23 16:55:17 -07:00
parent.c xfs: don't return EFSCORRUPTED when scrubbing corrupt parent pointers 2026-08-03 10:17:34 +02:00
parent_repair.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
quota.c xfs: scrub: unlock dquot before early return in quota scrub 2026-03-18 09:44:46 +01:00
quota.h xfs: repair quotas 2023-12-15 10:03:45 -08:00
quota_repair.c xfs: fix backwards skipping logic in xrep_quota_block 2026-09-07 07:50:36 +02:00
quotacheck.c xfs: don't leak dqacct if rhashtable insertion fails 2026-09-07 07:50:35 +02:00
quotacheck.h xfs: repair dquots based on live quotacheck results 2024-02-22 12:30:57 -08:00
quotacheck_repair.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
rcbag.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
rcbag.h xfs: create refcount bag structure for btree repairs 2024-02-22 12:43:41 -08:00
rcbag_btree.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
rcbag_btree.h xfs: create refcount bag structure for btree repairs 2024-02-22 12:43:41 -08:00
readdir.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
readdir.h xfs: deferred scrub of dirents 2024-04-23 07:47:02 -07:00
reap.c xfs: fix short ifork reaping computation in xreap_bmapi_binval 2026-09-07 07:50:35 +02:00
reap.h xfs: fix CoW forks for realtime files 2024-12-23 13:06:17 -08:00
refcount.c xfs: strengthen the "is cow staging" helpers in scrub 2026-09-07 07:50:36 +02:00
refcount_repair.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
repair.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
repair.h xfs: remove static reap limits from repair.h 2025-09-05 08:48:23 -07:00
rgb_bitmap.h xfs: capture realtime CoW staging extents when rebuilding rt rmapbt 2024-12-23 13:06:16 -08:00
rgsuper.c xfs: cross-reference the rtgroup superblock extent, not block 2026-09-07 07:50:36 +02:00
rmap.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
rmap_repair.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
rtb_bitmap.h xfs: fix CoW forks for realtime files 2024-12-23 13:06:17 -08:00
rtbitmap.c xfs: fix off-by-one error when calling xchk_xref_has_rt_owner 2026-07-14 11:01:47 +02:00
rtbitmap.h xfs: online repair of realtime bitmaps for a realtime group 2024-12-23 13:06:08 -08:00
rtbitmap_repair.c xfs: fix transaction block reservation in xrep_rtbitmap 2026-07-22 15:06:24 +02:00
rtrefcount.c xfs: fix rtrefcount btree block counting in scrub 2026-09-07 07:50:37 +02:00
rtrefcount_repair.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
rtrmap.c xfs: handle non-inode owners for rtrmap record checking 2026-07-14 11:01:47 +02:00
rtrmap_repair.c xfs: remove the i_ino field in struct xfs_inode 2026-06-09 09:14:41 +02:00
rtsummary.c xfs: rtsummary scrub should treat rtbitmap corruption errors as an xref error 2026-07-22 15:06:25 +02:00
rtsummary.h xfs: replace m_rsumsize with m_rsumblocks 2024-09-01 08:58:19 -07:00
rtsummary_repair.c xfs: make the rtsummary repair fix the file size too 2026-09-07 07:50:37 +02:00
scrub.c xfs: count escaped corruption errors in scrub stats 2026-09-07 07:50:37 +02:00
scrub.h xfs: remove several unused and never-implemented declarations 2026-09-07 08:21:54 +02:00
stats.c xfs: report runtime failures in scrub 2026-09-10 16:26:36 +02:00
stats.h xfs: count escaped corruption errors in scrub stats 2026-09-07 07:50:37 +02:00
symlink.c xfs: directly include xfs_platform.h 2026-01-21 12:57:16 +01:00
symlink_repair.c xfs: log the tempip after we convert it to extents format 2026-09-07 07:50:35 +02:00
tempexch.h xfs: online repair of realtime bitmaps for a realtime group 2024-12-23 13:06:08 -08:00
tempfile.c xfs: fix under-reservation of blocks when repairing sf directories 2026-09-11 08:37:30 +02:00
tempfile.h xfs: remove several unused and never-implemented declarations 2026-09-07 08:21:54 +02:00
trace.c xfs: add a XFS_INO_TO_FSB helper 2026-06-09 09:14:41 +02:00
trace.h xfs: report nonexistent parents as a filesystem corruption 2026-09-07 07:50:36 +02:00
xfarray.c xfs: set xfarray killable sort correctly 2026-07-14 11:01:47 +02:00
xfarray.h xfs: reduce the rate of cond_resched calls inside scrub 2024-04-23 16:55:17 -07:00
xfblob.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xfblob.h xfs: online repair of directories 2024-04-15 14:58:55 -07:00
xfile.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xfile.h xfs: repair extended attributes 2024-04-15 14:58:53 -07:00
xfs_scrub.h xfs: introduce vectored scrub mode 2024-04-23 16:55:18 -07:00