From c622ab08fe04a49f446d6c742d927b681062c801 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Thu, 23 Nov 2023 05:54:36 +0000 Subject: [PATCH] rgw/sfs: fail gracefully if objref not created It may happen if we conflict in-flight with another thread. Ensure we just fail gracefully to the client. Fixes: aquarist-labs/s3gw#820 Signed-off-by: Joao Eduardo Luis --- src/rgw/driver/sfs/multipart.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rgw/driver/sfs/multipart.cc b/src/rgw/driver/sfs/multipart.cc index c6a9f396943ce..39b7bf72a176a 100644 --- a/src/rgw/driver/sfs/multipart.cc +++ b/src/rgw/driver/sfs/multipart.cc @@ -443,6 +443,12 @@ int SFSMultipartUploadV2::complete( << dendl; 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. + return -ERR_INTERNAL_ERROR; + } auto destpath = store->get_data_path() / objref->get_storage_path(); lsfs_debug(dpp ) << fmt::format("moving final object from {} to {}", objpath, destpath)