-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Conversation
|
||
if (size > (1UL << 32) * 512) { | ||
r = -EINVAL; | ||
cerr << "rbd-nbd: image is too large (" << kb_t(size / 1024) << ", max is " |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
@dillaman Thanks, updated. |
@@ -594,6 +594,14 @@ static int do_map() | |||
} | |||
|
|||
size = info.size; | |||
|
|||
if (size > (1UL << 32) * 512) { | |||
r = -EINVAL; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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>
EFBIG looks much better! updated |
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? |
@edisno See http://tracker.ceph.com/issues/18335 |
Fixes: http://tracker.ceph.com/issues/17219
Signed-off-by: Mykola Golub mgolub@mirantis.com