diff --git a/src/rgw/driver/sfs/multipart.cc b/src/rgw/driver/sfs/multipart.cc index 39b7bf72a176a5..523ba6cf9d20aa 100644 --- a/src/rgw/driver/sfs/multipart.cc +++ b/src/rgw/driver/sfs/multipart.cc @@ -18,6 +18,7 @@ #include #include +#include #include #include "rgw/driver/sfs/fmt.h" @@ -441,12 +442,14 @@ int SFSMultipartUploadV2::complete( bucketref->get_bucket_id(), mp->object_name, e.what() ) << dendl; + std::filesystem::remove(objpath, ec); return -ERR_INTERNAL_ERROR; } if (!objref) { // We were unable to create a version, but this might very well have been // because we conflicted with another in-flight transaction. Lets return // back to the user, and they can complete it again if they so desire. + std::filesystem::remove(objpath, ec); return -ERR_INTERNAL_ERROR; } auto destpath = store->get_data_path() / objref->get_storage_path(); @@ -462,6 +465,7 @@ int SFSMultipartUploadV2::complete( destpath, ec.message() ) << dendl; + std::filesystem::remove(objpath, ec); return -ERR_INTERNAL_ERROR; } @@ -473,6 +477,7 @@ int SFSMultipartUploadV2::complete( objpath, destpath, cpp_strerror(errno) ) << dendl; + std::filesystem::remove(objpath, ec); return -ERR_INTERNAL_ERROR; }