Files
CephfsMig/internal/migration/native_factory_ceph.go
T
Sebastian UnterschützandClaude Opus 5.5 cc2dff46a0 feat(native): preserve ctime of files, directories and symlinks
The MDS takes an inode's ctime from the time stamp the client sends with
each request. The native backend overrides clock_gettime per thread and
per libcephfs call: modifying calls run at 1970-01-01T00:00:01Z, and the
last change to each entry creates and removes the xattr
user.cephmig.ctime stamped with the source ctime. Link, unlink, rename
and xattr requests set ctime = max(stamp, mtime), also backwards.

- write xattrs and quotas before SetAttr, which must come last
- always restamp directories after their children and hardlinks after
  linking or pruning, since the writer's cache may be stale
- verify through a separate, freshly mounted target client
- name the differing attributes in metadata mismatch errors
- compare ctime of every entry, the root included, in the lab fixture

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 19:33:19 +01:00

41 lines
939 B
Go

//go:build ceph && cgo
package migration
import (
"context"
"io"
"git.zb-server.de/Sebi/CephfsMig/internal/cephfsnative"
"git.zb-server.de/Sebi/CephfsMig/internal/storage"
)
func openNativeEngine(ctx context.Context, c Config, x Executor, log io.Writer) (Engine, io.Closer, error) {
if err := ctx.Err(); err != nil {
return Engine{}, nil, err
}
source, err := cephfsnative.Open(options(c.Source))
if err != nil {
return Engine{}, nil, err
}
target, err := cephfsnative.Open(options(c.Target))
if err != nil {
source.Close()
return Engine{}, nil, err
}
verifier := func() (storage.FS, error) {
v, err := cephfsnative.Open(options(c.Target))
if err != nil {
return nil, err
}
return v, nil
}
backend := &nativeTransport{source: source, target: target, config: c, log: log, openVerifier: verifier}
return Engine{Exec: x, Log: log, Transport: backend, Access: nativeAccess{backend}}, backend, nil
}