mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Cancel PutObjectPart on upload abort (#7940)
Calling ListMultipartUploads fails if an upload is aborted while a part is being uploaded because the directory for the upload exists (since fsRenameFile ends up calling os.MkdirAll) but the meta JSON file doesn't. To fix this we make sure an upload hasn't been aborted during PutObjectPart by checking the existence of the directory for the upload while moving the temporary part file into it.
This commit is contained in:
committed by
Harshavardhana
parent
87e6533cf3
commit
9389a55e5d
@@ -156,11 +156,11 @@ func renameAll(srcFilePath, dstFilePath string) (err error) {
|
||||
// Reliably retries os.RenameAll if for some reason os.RenameAll returns
|
||||
// syscall.ENOENT (parent does not exist).
|
||||
func reliableRename(srcFilePath, dstFilePath string) (err error) {
|
||||
if err = reliableMkdirAll(path.Dir(dstFilePath), 0777); err != nil {
|
||||
return err
|
||||
}
|
||||
i := 0
|
||||
for {
|
||||
if err = reliableMkdirAll(path.Dir(dstFilePath), 0777); err != nil {
|
||||
return err
|
||||
}
|
||||
// After a successful parent directory create attempt a renameAll.
|
||||
if err = os.Rename(srcFilePath, dstFilePath); err != nil {
|
||||
// Retry only for the first retryable error.
|
||||
|
||||
Reference in New Issue
Block a user