From 0bd875eb9e6d1ee690d7207c848e4c2a0758ac69 Mon Sep 17 00:00:00 2001 From: Or Ozeri Date: Tue, 22 May 2018 16:26:24 +0300 Subject: [PATCH] remove false readdir_multi_head warnings --- src/curl.cpp | 10 ++++++++-- src/curl.h | 1 + src/s3fs.cpp | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/curl.cpp b/src/curl.cpp index bf7dd58..e02ef89 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -3899,12 +3899,15 @@ int S3fsMultiCurl::MultiPerform(void) { std::vector threads; bool success = true; + bool isMultiHead = false; for(s3fscurlmap_t::iterator iter = cMap_req.begin(); iter != cMap_req.end(); ++iter) { pthread_t thread; S3fsCurl* s3fscurl = (*iter).second; int rc; + isMultiHead |= s3fscurl->GetOp() == "HEAD"; + rc = pthread_create(&thread, NULL, S3fsMultiCurl::RequestPerformWrapper, static_cast(s3fscurl)); if (rc != 0) { success = false; @@ -3925,7 +3928,7 @@ int S3fsMultiCurl::MultiPerform(void) S3FS_PRN_ERR("failed pthread_join - rc(%d)", rc); } else { int int_retval = (int)(intptr_t)(retval); - if (int_retval) { + if (int_retval && !(int_retval == ENOENT && isMultiHead)) { S3FS_PRN_WARN("thread failed - rc(%d)", int_retval); } } @@ -3954,7 +3957,10 @@ int S3fsMultiCurl::MultiRead(void) isRetry = true; }else if(404 == responseCode){ // not found - S3FS_PRN_WARN("failed a request(%ld: %s)", responseCode, s3fscurl->url.c_str()); + // HEAD requests on readdir_multi_head can return 404 + if(s3fscurl->GetOp() != "HEAD"){ + S3FS_PRN_WARN("failed a request(%ld: %s)", responseCode, s3fscurl->url.c_str()); + } }else if(500 == responseCode){ // case of all other result, do retry.(11/13/2013) // because it was found that s3fs got 500 error from S3, but could success diff --git a/src/curl.h b/src/curl.h index 3e46e03..b72de5a 100644 --- a/src/curl.h +++ b/src/curl.h @@ -439,6 +439,7 @@ class S3fsCurl std::string GetBasePath(void) const { return base_path; } std::string GetSpacialSavedPath(void) const { return saved_path; } std::string GetUrl(void) const { return url; } + std::string GetOp(void) const { return op; } headers_t* GetResponseHeaders(void) { return &responseHeaders; } BodyData* GetBodyData(void) const { return bodydata; } BodyData* GetHeadData(void) const { return headdata; } diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 4c940b9..b21926c 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -2572,7 +2572,7 @@ static int append_objects_from_xml_ex(const char* path, xmlDocPtr doc, xmlXPathC return -1; } if(xmlXPathNodeSetIsEmpty(contents_xp->nodesetval)){ - S3FS_PRN_WARN("contents_xp->nodesetval is empty."); + S3FS_PRN_DBG("contents_xp->nodesetval is empty."); S3FS_XMLXPATHFREEOBJECT(contents_xp); return 0; }