code: func replaceDirWithOverlayOpaque(path string) error {
  	if path == "/" {
  		return errors.New("replaceDirWithOverlayOpaque: path must not be \"/\"")
  	}
  	dir := filepath.Dir(path)
  	tmp, err := ioutil.TempDir(dir, "rdwoo")
  	if err != nil {
  		return errors.Wrapf(err, "failed to create a tmp directory under %s", dir)
  	}
  	defer os.RemoveAll(tmp)
  	// newPath is a new empty directory crafted with trusted.overlay.opaque xattr.
  	// we copy the content of path into newPath, remove path, and rename newPath to path.
  	newPath, err := createDirWithOverlayOpaque(tmp)
  	if err != nil {
  		return errors.Wrapf(err, "createDirWithOverlayOpaque(%q) failed", tmp)
  	}
  	if err := fs.CopyDir(newPath, path); err != nil {
  		return errors.Wrapf(err, "CopyDir(%q, %q) failed", newPath, path)
  	}
  	if err := os.RemoveAll(path); err != nil {
  		return err
  	}
  	return os.Rename(newPath, path)
  }
docs: // replaceDirWithOverlayOpaque replaces path with a new directory with trusted.overlay.opaque
  // xattr. The contents of the directory are preserved.