Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luminous: rgw_file: fix write error when the write offset overlaps. #18004

Merged
1 commit merged into from Oct 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/rgw/rgw_file.cc
Expand Up @@ -1155,6 +1155,15 @@ namespace rgw {
}
}

int overlap = 0;
if ((static_cast<off_t>(off) < f->write_req->real_ofs) &&
((f->write_req->real_ofs - off) <= len)) {
overlap = f->write_req->real_ofs - off;
off = f->write_req->real_ofs;
buffer = static_cast<char*>(buffer) + overlap;
len -= overlap;
}

buffer::list bl;
/* XXXX */
#if 0
Expand Down Expand Up @@ -1191,7 +1200,7 @@ namespace rgw {
rc = -EIO;
}

*bytes_written = (rc == 0) ? len : 0;
*bytes_written = (rc == 0) ? (len + overlap) : 0;
return rc;
} /* RGWFileHandle::write */

Expand Down