diff --git a/test/pjdfstest/known_failures.txt b/test/pjdfstest/known_failures.txt index a15ddfdc0..e6459933f 100644 --- a/test/pjdfstest/known_failures.txt +++ b/test/pjdfstest/known_failures.txt @@ -38,12 +38,9 @@ tests/unlink/02.t tests/unlink/03.t # ── Hard link nlink/ctime tracking (requires filer changes) ──────────── -# The filer does not update ctime on remaining hard link entries when one -# link is removed, and nlink counts are not correctly maintained across -# rename operations. +# nlink counts are not correctly maintained across rename operations. tests/rename/23.t tests/rename/24.t -tests/unlink/00.t # ── Parent directory mtime/ctime on deferred file create ─────────────── # When file creation is deferred (not flushed to filer immediately), diff --git a/weed/filer/filerstore_hardlink.go b/weed/filer/filerstore_hardlink.go index bfac44a71..ae5ff78a0 100644 --- a/weed/filer/filerstore_hardlink.go +++ b/weed/filer/filerstore_hardlink.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "time" "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" @@ -113,6 +114,9 @@ func (fsw *FilerStoreWrapper) DeleteHardLink(ctx context.Context, hardLinkId Har return fsw.KvDelete(ctx, key) } + // POSIX: update ctime when nlink changes (a hard link was removed). + entry.Attr.Ctime = time.Now().UTC() + newBlob, encodeErr := entry.EncodeAttributesAndChunks() if encodeErr != nil { return encodeErr