From c3c4085a81492942cacd1c6508cf7f136395449f Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 12 Nov 2026 17:11:59 -0800 Subject: [PATCH] mount: stop a flush merge once a filer accepts the write withFilerClient can call the callback on several filers. A refusal from one left its stored entry behind, so a later filer's success went on to another merge round. Co-Authored-By: Claude Opus 5.5 --- weed/mount/weedfs_file_sync.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/weed/mount/weedfs_file_sync.go b/weed/mount/weedfs_file_sync.go index 507f1352c0..50470a9888 100644 --- a/weed/mount/weedfs_file_sync.go +++ b/weed/mount/weedfs_file_sync.go @@ -338,6 +338,7 @@ func (wfs *WFS) createContentEntry(ctx context.Context, fh *FileHandle, request var stored *filer_pb.Entry err = wfs.withFilerClient(ctx, false, wfs.filerRPCWait(), func(ctx context.Context, client filer_pb.SeaweedFilerClient) error { var callErr error + stored = nil resp, callErr = filer_pb.CreateEntryWithResponse(ctx, client, request) if base == nil || attempt >= maxContentFlushMerges || !errors.Is(callErr, filer_pb.ErrPreconditionFailed) { return callErr @@ -351,7 +352,7 @@ func (wfs *WFS) createContentEntry(ctx context.Context, fh *FileHandle, request merged = proto.Clone(request.Entry).(*filer_pb.Entry) wfs.mapPbIdFromFilerToLocal(merged) } - if stored == nil { + if err == nil || stored == nil { return resp, merged, err } next, ok := mergeContentEntry(stored, base, local, sent)