pools: GetObjectNInfo should cover locking during object read (#14887)

In case of multi-pools setup, GetObjectNInfo returns a GetObjectReader
but it unlocks the read lock when quitting GetObjectNInfo. This should
not happen, unlock should only happen when GetObjectReader is closed.
This commit is contained in:
Anis Elleuch 2022-05-10 15:47:40 +01:00 committed by GitHub
parent d909f167ff
commit 1e037883b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -774,7 +774,16 @@ func (z *erasureServerPools) GetObjectNInfo(ctx context.Context, bucket, object
}
lockType = noLock // do not take locks at lower levels for GetObjectNInfo()
return z.serverPools[zIdx].GetObjectNInfo(ctx, bucket, object, rs, h, lockType, opts)
gr, err = z.serverPools[zIdx].GetObjectNInfo(ctx, bucket, object, rs, h, lockType, opts)
if err != nil {
return nil, err
}
if unlockOnDefer {
unlockOnDefer = false
return gr.WithCleanupFuncs(nsUnlocker), nil
}
return gr, nil
}
// getLatestObjectInfoWithIdx returns the objectInfo of the latest object from multiple pools (this function