Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] xfs: fix zero-link inode link count handling
@ 2026-11-24 11:53 Ran Hongyun
  2026-11-24 19:49 ` Dave Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Ran Hongyun @ 2026-11-24 11:53 UTC (permalink / raw)
  To: cem, djwong
  Cc: linux-xfs, ranhongyun1, chengzhihao1, yangerkun, yi.zhang,
	wozizhi

This series fixes two paths that hand a zero-link inode to the VFS link
count helpers.

Patch 1 makes the metadir repair code set the link count directly when
reconnecting an inode that was found on the unlinked list, instead of
calling inc_nlink() on a zero-link inode.

Patch 2 makes xfs_bumplink() reject the abnormal zero link count with
-EFSCORRUPTED.  A crafted image can contain a reachable directory with
di_nlink == 0; mkdir() or rename() into it then reaches inc_nlink() and
trips the VFS warning.

Ran Hongyun (2):
  xfs: set link count when reconnecting zero-link metadir files
  xfs: refuse to bump the link count of zero-link inodes

 fs/xfs/libxfs/xfs_dir2.c       | 24 ++++++++++++++++++------
 fs/xfs/libxfs/xfs_inode_util.c | 14 ++++++++++++--
 fs/xfs/libxfs/xfs_inode_util.h |  2 +-
 fs/xfs/scrub/metapath.c        | 14 ++++++++++++--
 fs/xfs/scrub/orphanage.c       | 11 ++++++++---
 5 files changed, 51 insertions(+), 14 deletions(-)

-- 
2.52.0


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

end of thread, other threads:[~2026-11-24 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 11:53 [PATCH 0/2] xfs: fix zero-link inode link count handling Ran Hongyun
2026-11-24 19:49 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox