On Mon, Nov 02, 2020 at 06:01:20PM +0800, Gao Xiang wrote: > Sometimes, it's not true that the root directory is always > the first result from calling bulkstat with lastino == 0 > assumed by xfsdump. > > Recently XFS_BULK_IREQ_SPECIAL_ROOT was introduced last year, > yet that doesn't exist in old kernels. > > Alternatively, we can also use bulkstat to walk through > all dirs and find the exact dir whose ino # of ".." is > itself by getdents, and that should be considered as the > root dir. > > Fixes: 25195ebf107d ("xfsdump: handle bind mount targets") > Cc: Eric Sandeen <sandeen@xxxxxxxxxx> > Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxx> > --- > preliminary test with the original testcase is done... I think that way is feasible, yet if my own understanding on xfsdump codebase is correct, xfsdump itself won't record ".." dirent for all its dir records, so I'm not sure how to find the root inode # for already broken images easily (maybe we might use union-find algorithm to scan all dirs, and then deduce the real root dir via the result of the algorithm, still looking into that if it's possible and easy to implement ...) Thanks, Gao Xiang