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>
This commit is contained in:
1 parent
02ebc08c88
commit
cc2dff46a0
11 files changed
+491
-96
No files matched your search
@@ -65,9 +65,13 @@ func (b *nativeTransport) copyRegular(ctx context.Context, job nativeJob) error
|
||||
}
|
||||
|
||||
exists := statErr == nil && target.Kind() == storage.Regular
|
||||
// A newer ctime than the migration set means the file was changed outside
|
||||
// the migration, so a block delta against the previous round would be
|
||||
// wrong. A full copy replaces it with a new inode.
|
||||
replace := exists && target.Ctime.After(wantedCtime(job.node))
|
||||
var previous baseEntry
|
||||
trusted := false
|
||||
if b.delta && exists {
|
||||
if b.delta && exists && !replace {
|
||||
var ok bool
|
||||
var err error
|
||||
previous, ok, err = b.base.entry(job.rel)
|
||||
@@ -326,6 +330,21 @@ func (b *nativeTransport) Verify(ctx context.Context, from, to string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if b.openVerifier != nil {
|
||||
v, err := b.openVerifier()
|
||||
if err != nil {
|
||||
return fmt.Errorf("native verification client: %w", err)
|
||||
}
|
||||
|
||||
// The engine calls transport methods one at a time.
|
||||
writer := b.target
|
||||
b.target = v
|
||||
defer func() {
|
||||
b.target = writer
|
||||
v.Close()
|
||||
}()
|
||||
}
|
||||
|
||||
skipData := b.verified[to]
|
||||
scratch, err := osNativeVerifyIndex(b.workspace)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user