diff --git a/changelog/unreleased/improve-posixfs.md b/changelog/unreleased/improve-posixfs.md index aabc950e4e..3cb42e3c80 100644 --- a/changelog/unreleased/improve-posixfs.md +++ b/changelog/unreleased/improve-posixfs.md @@ -2,5 +2,6 @@ Enhancement: Improve posixfs stability and performance The posixfs storage driver saw a number of bugfixes and optimizations. +https://github.com/cs3org/reva/pull/4889 https://github.com/cs3org/reva/pull/4877 diff --git a/pkg/storage/utils/decomposedfs/upload/upload.go b/pkg/storage/utils/decomposedfs/upload/upload.go index f3a2fed476..427af92dbc 100644 --- a/pkg/storage/utils/decomposedfs/upload/upload.go +++ b/pkg/storage/utils/decomposedfs/upload/upload.go @@ -178,7 +178,6 @@ func (session *OcisSession) FinishUpload(ctx context.Context) error { return err } } - // increase the processing counter for every started processing // will be decreased in Cleanup() metrics.UploadProcessing.Inc() @@ -213,7 +212,9 @@ func (session *OcisSession) FinishUpload(ctx context.Context) error { } } - if !session.store.async { + // if the upload is synchronous or the upload is empty, finalize it now + // for 0-byte uploads we take a shortcut and finalize isn't called elsewhere + if !session.store.async || session.info.Size == 0 { // handle postprocessing synchronously err = session.Finalize() session.store.Cleanup(ctx, session, err != nil, false, err == nil)