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

os/filestore: fix punch hole usage in _zero #8050

Merged
merged 2 commits into from Mar 14, 2016
Merged

Conversation

liewegas
Copy link
Member

If we punch a hole that extends past EOF, ObjectStore semantics are
that the file size is also extended. Do that.

Note that this bug was hidden before because we weren't passing
KEEP_SIZE to fallocate until 7bd95b5
and the fallocate was always failing with EOPNOTSUPP (making us fall
back to writing actual zeros).

Signed-off-by: Sage Weil sage@redhat.com

If we punch a hole that extends past EOF, ObjectStore semantics are
that the file size is also extended.  Do that.

Note that this bug was hidden before because we weren't passing
KEEP_SIZE to fallocate until 7bd95b5
and the fallocate was *always* failing with EOPNOTSUPP (making us fall
back to writing actual zeros).

Signed-off-by: Sage Weil <sage@redhat.com>
Make punch hole usage optional.

Default to off, since it's relatively untested.

Signed-off-by: Sage Weil <sage@redhat.com>
} else {
// ensure we extent file size, if needed
if (offset + len > st.st_size) {
ret = ::ftruncate(**fd, offset + len);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little nervous about this, what if we want to zero 10->5 and size is 12. from my glancing view, 12-15 will be zeroed, but what about 10-12 section(not zeroed)?

Another thought: it looks like PUNCH_HOLE isn't fullly match _zero semantic, FALLOC_FL_ZERO_RANGE may better

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I have a misunderstand on this bug.

@athanatos
Copy link
Contributor

lgtm

liewegas added a commit that referenced this pull request Mar 14, 2016
os/filestore: fix punch hole usage in _zero

Reviewed-by: Samuel Just <sjust@redhat.com>
@liewegas liewegas merged commit 8c9190f into ceph:master Mar 14, 2016
@liewegas liewegas deleted the wip-15077 branch March 14, 2016 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants