Skip to content

Commit

Permalink
Fixed readdir bug with objects receiving EPERM on HEAD request
Browse files Browse the repository at this point in the history
  • Loading branch information
ggtakec committed Nov 3, 2024
1 parent ef6c213 commit 17ecf16
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/curl_multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,22 @@ int S3fsMultiCurl::MultiPerform()
auto it = threads.find(thread_id);
it->second.first.join();
auto int_retval = it->second.second.get();
if (int_retval && !(int_retval == -ENOENT && isMultiHead)) {

// [NOTE]
// For multipart HEAD requests(ex. readdir), we need to consider the
// cases where you may get ENOENT and EPERM.
// For example, we will get ENOENT when sending a HEAD request to a
// directory of an object whose path contains a directory uploaded
// from a client other than s3fs.
// We will also get EPERM if you try to read an encrypted object
// (such as KMS) without specifying SSE or with a different KMS key.
// In these cases, if we end this method with that error result,
// the caller will not be able to continue processing.(readdir will
// fail.)
// Therefore, if those conditions are met here, avoid setting it to
// result.
//
if(!isMultiHead || (-ENOENT != int_retval && -EPERM != int_retval)){
S3FS_PRN_WARN("thread terminated with non-zero return code: %d", int_retval);
result = int_retval;
}
Expand Down

0 comments on commit 17ecf16

Please sign in to comment.