Skip to content

Commit 3b4ba8b

Browse files
authored
Merge pull request ceph#53266 from VVoidV/lbr-chunk-upload-buffer-fix
rgw: improve buffer list utilization in the chunkupload scenario Reviewed-by: Casey Bodley <[email protected]>
2 parents 12bc70b + e47bb22 commit 3b4ba8b

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/rgw/rgw_auth_s3.cc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ bool AWSv4ComplMulti::is_signature_mismatched()
11411141
}
11421142
}
11431143

1144-
size_t AWSv4ComplMulti::recv_body(char* const buf, const size_t buf_max)
1144+
size_t AWSv4ComplMulti::recv_chunk(char* const buf, const size_t buf_max, bool& eof)
11451145
{
11461146
/* Buffer stores only parsed stream. Raw values reflect the stream
11471147
* we're getting from a client. */
@@ -1166,6 +1166,7 @@ size_t AWSv4ComplMulti::recv_body(char* const buf, const size_t buf_max)
11661166
to_extract);
11671167
parsing_buf.resize(parsing_buf.size() - (to_extract - received));
11681168
if (received == 0) {
1169+
eof = true;
11691170
break;
11701171
}
11711172

@@ -1215,6 +1216,7 @@ size_t AWSv4ComplMulti::recv_body(char* const buf, const size_t buf_max)
12151216
dout(30) << "AWSv4ComplMulti: to_extract=" << to_extract << ", received=" << received << dendl;
12161217

12171218
if (received == 0) {
1219+
eof = true;
12181220
break;
12191221
}
12201222

@@ -1229,6 +1231,19 @@ size_t AWSv4ComplMulti::recv_body(char* const buf, const size_t buf_max)
12291231
return buf_pos;
12301232
}
12311233

1234+
size_t AWSv4ComplMulti::recv_body(char* const buf, const size_t buf_max)
1235+
{
1236+
bool eof = false;
1237+
size_t total = 0;
1238+
1239+
while (total < buf_max && !eof) {
1240+
const size_t received = recv_chunk(buf + total, buf_max - total, eof);
1241+
total += received;
1242+
}
1243+
dout(20) << "AWSv4ComplMulti: received=" << total << dendl;
1244+
return total;
1245+
}
1246+
12321247
void AWSv4ComplMulti::modify_request_state(const DoutPrefixProvider* dpp, req_state* const s_rw)
12331248
{
12341249
const char* const decoded_length = \

src/rgw/rgw_auth_s3.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ class AWSv4ComplMulti : public rgw::auth::Completer,
331331

332332
bool is_signature_mismatched();
333333
std::string calc_chunk_signature(const std::string& payload_hash) const;
334+
size_t recv_chunk(char* buf, size_t max, bool& eof);
334335

335336
public:
336337
/* We need the constructor to be public because of the std::make_shared that

0 commit comments

Comments
 (0)