Skip to content

Commit

Permalink
cmd/debug: assuming the mount point is juicefs mount point
Browse files Browse the repository at this point in the history
Signed-off-by: zhijian <[email protected]>
  • Loading branch information
zhijian-pro committed Dec 25, 2024
1 parent 1297700 commit 198ac79
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions cmd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,20 @@ func collectSpecialFile(ctx *cli.Context, amp string, currDir string, requireRoo
func debug(ctx *cli.Context) error {
setup(ctx, 1)
mp := ctx.Args().First()
inode, err := utils.GetFileInode(mp)
if err != nil {
return fmt.Errorf("failed to lookup inode for %s: %s", mp, err)
}
if inode != uint64(meta.RootInode) {
return fmt.Errorf("path %s is not a mount point", mp)
var inode uint64
if err := utils.WithTimeout(func() error {
var err error
if inode, err = utils.GetFileInode(mp); err != nil {
return fmt.Errorf("failed to lookup inode for %s: %s", mp, err)
}
return nil
}, 3*time.Second); err != nil {
logger.Warnf(err.Error())
logger.Warnf("assuming the mount point is JuiceFS mount point")
} else {
if inode != uint64(meta.RootInode) {
return fmt.Errorf("path %s is not a mount point", mp)
}
}

amp, err := filepath.Abs(mp)
Expand Down

0 comments on commit 198ac79

Please sign in to comment.