linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/6] xfs_repair: do not trash valid root dirs
@ 2020-01-24  0:17 Darrick J. Wong
  2020-01-24  0:17 ` [PATCH 1/6] mkfs: check root inode location Darrick J. Wong
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Darrick J. Wong @ 2020-01-24  0:17 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: linux-xfs, alex

Hi all,

Alex Lyakas observed that xfs_repair can accidentally trash the root
directory on a filesystem.  Specifically, if one formats a V4 filesystem
without sparse inodes but with sunit/swidth set and then mounts that
filesystem with a different sunit/swidth, the kernel will update the
values in the superblock.  This causes xfs_repair's sb_rootino
estimation to differ from the actual root directory, and it discards the
actual root directory even though there's nothing wrong with it.

Therefore, hoist the logic that computes the root inode location into
libxfs so that the kernel will avoid the sb update if the proposed
sunit/swidth changes would alter the sb_rootino estimation; and then
teach xfs_repair to retain the root directory even if the estimation
doesn't add up, as long as sb_rootino points to a directory whose '..'
entry points to itself.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-find-rootdir

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-find-rootdir

^ permalink raw reply	[flat|nested] 21+ messages in thread
* [PATCH v2 0/6] xfs_repair: do not trash valid root dirs
@ 2020-01-01  1:20 Darrick J. Wong
  2020-01-01  1:20 ` [PATCH 2/6] xfs_repair: enforce that inode btree chunks can't point to AG headers Darrick J. Wong
  0 siblings, 1 reply; 21+ messages in thread
From: Darrick J. Wong @ 2020-01-01  1:20 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: linux-xfs, alex

Hi all,

Alex Lyakas observed that xfs_repair can accidentally trash the root
directory on a filesystem.  Specifically, if one formats a V4 filesystem
without sparse inodes but with sunit/swidth set and then mounts that
filesystem with a different sunit/swidth, the kernel will update the
values in the superblock.  This causes xfs_repair's sb_rootino
estimation to differ from the actual root directory, and it discards the
actual root directory even though there's nothing wrong with it.

Therefore, hoist the logic that computes the root inode location into
libxfs so that the kernel will avoid the sb update if the proposed
sunit/swidth changes would alter the sb_rootino estimation; and then
teach xfs_repair to retain the root directory even if the estimation
doesn't add up, as long as sb_rootino points to a directory whose '..'
entry points to itself.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-find-rootdir

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-find-rootdir

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

end of thread, other threads:[~2020-01-30 20:52 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-24  0:17 [PATCH v3 0/6] xfs_repair: do not trash valid root dirs Darrick J. Wong
2020-01-24  0:17 ` [PATCH 1/6] mkfs: check root inode location Darrick J. Wong
2020-01-30 19:32   ` Eric Sandeen
2020-01-30 20:19     ` Darrick J. Wong
2020-01-30 20:34       ` Eric Sandeen
2020-01-24  0:17 ` [PATCH 2/6] xfs_repair: enforce that inode btree chunks can't point to AG headers Darrick J. Wong
2020-01-30 19:38   ` Eric Sandeen
2020-01-30 20:26     ` Darrick J. Wong
2020-01-30 20:46       ` Eric Sandeen
2020-01-24  0:17 ` [PATCH 3/6] xfs_repair: refactor fixed inode location checks Darrick J. Wong
2020-01-30 19:45   ` Eric Sandeen
2020-01-30 19:52     ` Eric Sandeen
2020-01-24  0:17 ` [PATCH 4/6] xfs_repair: use libxfs function to calculate root inode location Darrick J. Wong
2020-01-30 19:48   ` Eric Sandeen
2020-01-24  0:17 ` [PATCH 5/6] xfs_repair: check plausibility of root dir pointer before trashing it Darrick J. Wong
2020-01-30 20:18   ` Eric Sandeen
2020-01-30 20:34     ` Darrick J. Wong
2020-01-30 20:41       ` Eric Sandeen
2020-01-30 20:50         ` Darrick J. Wong
2020-01-24  0:18 ` [PATCH 6/6] xfs_repair: try to correct sb_unit value from secondaries Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2020-01-01  1:20 [PATCH v2 0/6] xfs_repair: do not trash valid root dirs Darrick J. Wong
2020-01-01  1:20 ` [PATCH 2/6] xfs_repair: enforce that inode btree chunks can't point to AG headers Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).