From 4a0c23258e859ab6b48783efbc6405b52f2906a0 Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Mon, 12 Aug 2019 16:30:36 +0000 Subject: [PATCH] Fixed MultiRead method to exit after waiting other parts at error --- src/curl.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/curl.cpp b/src/curl.cpp index 4f21ec5..fa2cd6c 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -4150,6 +4150,8 @@ int S3fsMultiCurl::MultiPerform() int S3fsMultiCurl::MultiRead() { + int result = 0; + for(s3fscurllist_t::iterator iter = clist_req.begin(); iter != clist_req.end(); ++iter) { S3fsCurl* s3fscurl = *iter; @@ -4187,7 +4189,9 @@ int S3fsMultiCurl::MultiRead() S3FS_PRN_ERR("failed a request(Unknown response code: %s)", s3fscurl->url.c_str()); } - if(!isRetry){ + if(!isRetry || 0 != result){ + // If an EIO error has already occurred, it will be terminated + // immediately even if retry processing is required. s3fscurl->DestroyCurlHandle(); delete s3fscurl; @@ -4200,8 +4204,8 @@ int S3fsMultiCurl::MultiRead() if(NULL != retrycurl){ clist_all.push_back(retrycurl); }else{ - // Could not set up callback. - return -EIO; + // set EIO and wait for other parts. + result = -EIO; } } if(s3fscurl != retrycurl){ @@ -4212,7 +4216,14 @@ int S3fsMultiCurl::MultiRead() } clist_req.clear(); - return 0; + if(0 != result){ + // If an EIO error has already occurred, clear all retry objects. + for(s3fscurllist_t::iterator iter = clist_all.begin(); iter != clist_all.end(); ++iter){ + delete (*iter); + } + clist_all.clear(); + } + return result; } int S3fsMultiCurl::Request()