linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/4] xfs_repair: do not trash valid root dirs
@ 2019-12-02 17:35 Darrick J. Wong
  2019-12-02 17:36 ` [PATCH 1/4] xfs: don't commit sunit/swidth updates to disk if that would cause repair failures Darrick J. Wong
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Darrick J. Wong @ 2019-12-02 17:35 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.

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

--D

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

end of thread, other threads:[~2019-12-04 11:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 17:35 [PATCH RFC 0/4] xfs_repair: do not trash valid root dirs Darrick J. Wong
2019-12-02 17:36 ` [PATCH 1/4] xfs: don't commit sunit/swidth updates to disk if that would cause repair failures Darrick J. Wong
2019-12-02 17:36 ` [PATCH 2/4] mkfs: check root inode location Darrick J. Wong
2019-12-03 13:02   ` Brian Foster
2019-12-03 23:40     ` Darrick J. Wong
2019-12-04 11:51       ` Brian Foster
2019-12-02 17:36 ` [PATCH 3/4] xfs_repair: use xfs_ialloc_find_prealloc Darrick J. Wong
2019-12-02 17:36 ` [PATCH 4/4] xfs_repair: check plausiblitiy of root dir pointer Darrick J. Wong
2019-12-03 13:03   ` Brian Foster
2019-12-04  0:11     ` 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).