feat!: remove the rsync backend

The native libcephfs backend is the only transfer path. The rsync
transport, the mounted-filesystem access and its helpers (mount check,
path resolution below a mount, mount claim, quota and hardlink repair
through the mount) are removed, together with the rsync lab test and
the client image that only added rsync.

The claim and release tests now exercise the native claim through a
local test file system with real flock locks.

BREAKING CHANGE: "backend": "rsync" and the endpoint field "mount" are
rejected. "backend" is optional and only accepts "native"; jobs created
with "native" resume without it. Journals of rsync jobs cannot be
resumed. Builds without the build tag ceph only support doctor and
status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-12-03 22:03:22 +01:00
1 parent f0ea1fd7cd
commit 330a3ec12c
31 files changed
+263 -1522

No files matched your search

-143
View File
@@ -2,14 +2,6 @@ package migration
import (
"bytes"
"context"
"encoding/binary"
"errors"
"fmt"
"io/fs"
"os"
"path/filepath"
"syscall"
"time"
bolt "go.etcd.io/bbolt"
@@ -82,138 +74,3 @@ func (x *linkIndex) observe(bucket string, key, value [16]byte) (bool, error) {
return same, nil
}
func inodeIdentity(info os.FileInfo) ([16]byte, uint64, error) {
var key [16]byte
st, ok := info.Sys().(*syscall.Stat_t)
if !ok {
return key, 0, errors.New("missing Linux inode information")
}
binary.BigEndian.PutUint64(key[:8], uint64(st.Dev))
binary.BigEndian.PutUint64(key[8:], st.Ino)
return key, uint64(st.Nlink), nil
}
// hardlinkTopology compares the hard-link groups of src and dst.
// In repair mode it removes only excess target hardlinks. Missing paths are then
// recreated by the copy backend. In verification mode check both directions:
// source groups must stay joined, and unrelated source files must stay separate.
func hardlinkTopology(ctx context.Context, src, dst, scratchParent string, repair bool) (result error) {
scratch, err := os.MkdirTemp(scratchParent, ".cephmig-links-")
if err != nil {
return err
}
defer os.RemoveAll(scratch)
index, err := openLinkIndex(filepath.Join(scratch, "index.bolt"))
if err != nil {
return err
}
defer func() {
if err := index.close(); result == nil {
result = err
}
}()
targetPath := func(path string) (string, error) {
rel, err := filepath.Rel(src, path)
if err != nil || !beneath(src, path) {
return "", fmt.Errorf("hardlink path outside source: %s", path)
}
return filepath.Join(dst, rel), nil
}
visitDir := func(path string) error {
target, err := targetPath(path)
if err != nil {
return err
}
st, err := os.Lstat(target)
if repair && (errors.Is(err, os.ErrNotExist) || (err == nil && !st.IsDir())) {
// Never follow a target symlink directory, even when its referent exists.
return fs.SkipDir
}
if err != nil {
return err
}
if !st.IsDir() {
return fmt.Errorf("target directory changed type: %s", target)
}
return nil
}
visitFile := func(path string, sourceInfo os.FileInfo) error {
if !sourceInfo.Mode().IsRegular() {
return nil
}
target, err := targetPath(path)
if err != nil {
return err
}
targetInfo, err := os.Lstat(target)
if repair && errors.Is(err, os.ErrNotExist) {
return nil
}
if err != nil {
return err
}
if !targetInfo.Mode().IsRegular() {
if repair {
return nil
}
return fmt.Errorf("hardlink target is not a regular file: %s", target)
}
sourceKey, sourceLinks, err := inodeIdentity(sourceInfo)
if err != nil {
return err
}
targetKey, targetLinks, err := inodeIdentity(targetInfo)
if err != nil {
return err
}
if !repair && sourceLinks > 1 {
same, err := index.observe("source", sourceKey, targetKey)
if err != nil {
return err
}
if !same {
return fmt.Errorf("source hardlink group was split at %s", target)
}
}
if targetLinks > 1 {
same, err := index.observe("target", targetKey, sourceKey)
if err != nil {
return err
}
if !same {
if !repair {
return fmt.Errorf("unrelated source files became hardlinked at %s", target)
}
if err := os.Remove(target); err != nil {
return fmt.Errorf("break obsolete target hardlink: %w", err)
}
}
}
return nil
}
return walkTree(ctx, src, visitDir, visitFile)
}