code: func findExistingPrefix(base, pathname string) (string, []string, error) {
  	rel, err := filepath.Rel(base, pathname)
  	if err != nil {
  		return base, nil, err
  	}
  
  	if mount.StartsWithBackstep(rel) {
  		return base, nil, fmt.Errorf("pathname(%s) is not within base(%s)", pathname, base)
  	}
  
  	if rel == "." {
  		// base and pathname are equal
  		return pathname, []string{}, nil
  	}
  
  	dirs := strings.Split(rel, string(filepath.Separator))
  
  	parent := base
  	currentPath := base
  	for i, dir := range dirs {
  		parent = currentPath
  		currentPath = filepath.Join(parent, dir)
  		if _, err := os.Lstat(currentPath); err != nil {
  			if os.IsNotExist(err) {
  				return parent, dirs[i:], nil
  			}
  			return base, nil, err
  		}
  	}
  
  	return pathname, []string{}, nil
  }
docs: // findExistingPrefix finds prefix of pathname that exists. In addition, it
  // returns list of remaining directories that don't exist yet.