mirror of
https://github.com/ceph/ceph
synced 2025-02-23 02:57:21 +00:00
Merge pull request #30257 from ligangbin117/wip-ligangbin-rgw-data-error
rgw:[bug] fix data consistency error casued by rgw sent timeout Reviewed-by: Yuli Yang <yuliyang@cmss.chinamobile.com> Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
commit
4a23fc109e
@ -15,15 +15,17 @@
|
||||
|
||||
size_t RGWCivetWeb::write_data(const char *buf, const size_t len)
|
||||
{
|
||||
size_t off = 0;
|
||||
auto to_sent = len;
|
||||
while (to_sent) {
|
||||
const int ret = mg_write(conn, buf, len);
|
||||
const int ret = mg_write(conn, buf + off, to_sent);
|
||||
if (ret < 0 || ! ret) {
|
||||
/* According to the documentation of mg_write() it always returns -1 on
|
||||
* error. The details aren't available, so we will just throw EIO. Same
|
||||
* goes to 0 that is associated with writing to a closed connection. */
|
||||
throw rgw::io::Exception(EIO, std::system_category());
|
||||
} else {
|
||||
off += static_cast<size_t>(ret);
|
||||
to_sent -= static_cast<size_t>(ret);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user