From 4856ab11ffd399864d458a6553fec30e9f244886 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 20 Mar 2024 12:39:20 +0300 Subject: [PATCH] Complete MPU when allowed and under memory pressure Fixes hang in a rather simple case: rm mnt/file && \ fio -name=test -ioengine=libaio -direct=1 -iodepth=4 -bsrange=4k-512k \ -rw=write -size=10G -filename=mnt/file && \ fio -name=test -ioengine=libaio -direct=1 -iodepth=4 -bsrange=4k-512k \ -rw=randwrite -size=10G -filename=mnt/file Previous fixes to "infinite loop" + GetHoles fix the same case but with ~15s pause between fio write and randwrite to allow GeeseFS to complete MPU at least once --- internal/file.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/file.go b/internal/file.go index 2586a44..300c479 100644 --- a/internal/file.go +++ b/internal/file.go @@ -769,7 +769,7 @@ func (inode *Inode) sendUpload() bool { canComplete = canComplete && !inode.IsRangeLocked(0, inode.Attributes.Size, true) - if canComplete && (inode.fileHandles == 0 || inode.forceFlush) { + if canComplete && (inode.fileHandles == 0 || inode.forceFlush || atomic.LoadInt32(&inode.fs.wantFree) > 0) { // Complete the multipart upload inode.IsFlushing += inode.fs.flags.MaxParallelParts atomic.AddInt64(&inode.fs.stats.flushes, 1)