Fixed MultiRead method to exit after waiting other parts at error

This commit is contained in:
Takeshi Nakatani 2019-08-12 16:30:36 +00:00 committed by Andrew Gaul
parent ccc79ec139
commit 4a0c23258e

View File

@ -4150,6 +4150,8 @@ int S3fsMultiCurl::MultiPerform()
int S3fsMultiCurl::MultiRead() int S3fsMultiCurl::MultiRead()
{ {
int result = 0;
for(s3fscurllist_t::iterator iter = clist_req.begin(); iter != clist_req.end(); ++iter) { for(s3fscurllist_t::iterator iter = clist_req.begin(); iter != clist_req.end(); ++iter) {
S3fsCurl* s3fscurl = *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()); 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(); s3fscurl->DestroyCurlHandle();
delete s3fscurl; delete s3fscurl;
@ -4200,8 +4204,8 @@ int S3fsMultiCurl::MultiRead()
if(NULL != retrycurl){ if(NULL != retrycurl){
clist_all.push_back(retrycurl); clist_all.push_back(retrycurl);
}else{ }else{
// Could not set up callback. // set EIO and wait for other parts.
return -EIO; result = -EIO;
} }
} }
if(s3fscurl != retrycurl){ if(s3fscurl != retrycurl){
@ -4212,7 +4216,14 @@ int S3fsMultiCurl::MultiRead()
} }
clist_req.clear(); 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() int S3fsMultiCurl::Request()