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

rbd-nbd: disallow mapping images >2TB in size #11741

Merged
merged 1 commit into from
Nov 4, 2016

Conversation

trociny
Copy link
Contributor

@trociny trociny commented Nov 2, 2016

Fixes: http://tracker.ceph.com/issues/17219
Signed-off-by: Mykola Golub mgolub@mirantis.com


if (size > (1UL << 32) * 512) {
r = -EINVAL;
cerr << "rbd-nbd: image is too large (" << kb_t(size / 1024) << ", max is "
Copy link

Choose a reason for hiding this comment

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

Minor: you can use the prettybyte_t helper function to avoid the extra division.

@@ -4,6 +4,7 @@

POOL=rbd
IMAGE=testrbdnbd$$
TOOLARGE_IMAGE=${IMAGE}_large
Copy link

Choose a reason for hiding this comment

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

Minor: suggest adding an underscore between "TOO" and "LARGE" to make it clearer

@trociny
Copy link
Contributor Author

trociny commented Nov 2, 2016

@dillaman Thanks, updated.

@@ -594,6 +594,14 @@ static int do_map()
}

size = info.size;

if (size > (1UL << 32) * 512) {
r = -EINVAL;
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: would E2BIG be a more appropriate errcode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure. E2BIG is usually used when user input parameters are too big. This looks a little different. Still I don't have a strong opinion. @dillaman what do you think?

Copy link

Choose a reason for hiding this comment

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

I don't think E2BIG is a correct error code for the reason Mykola stated. You might be able to get away with EFBIG for "file too large"

Fixes: http://tracker.ceph.com/issues/17219
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
@trociny
Copy link
Contributor Author

trociny commented Nov 3, 2016

EFBIG looks much better! updated

@dillaman dillaman merged commit 1ad92a5 into ceph:master Nov 4, 2016
@trociny trociny deleted the wip-17219 branch November 5, 2016 09:09
@edisno
Copy link

edisno commented Feb 1, 2017

I am having problems doing discard/trim on newly created rbd volumes. The krbd client in linux 4.8.0 does not support certain default rbd flags, and rbd-fuse seems to not support trim/discard. rbd-nbd does, but it is limited to 2TB and my volumes are much larger. Any idea if rbd-nbd might support >2TB (properly) soon? I read somewhere that this problem might only affect 32-bit systems, so would I risk data corruption by commenting out the check on my (64-bit) system?

@trociny
Copy link
Contributor Author

trociny commented Feb 1, 2017

@edisno See http://tracker.ceph.com/issues/18335
So we have plans to allow >2TB for not affected kernels. I am going to work on this ticket soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants