All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@inktank.com>
To: Josh Durgin <josh.durgin@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 1/4] rbd: verify rbd image order value
Date: Fri, 26 Oct 2012 17:06:01 -0500	[thread overview]
Message-ID: <508B0949.7000906@inktank.com> (raw)
In-Reply-To: <50882D25.8010706@inktank.com>

On 10/24/2012 01:02 PM, Josh Durgin wrote:
> Might want to add some output so we can tell which error
> is being hit.

This is true for all of the cases that fail, not just those
I'm adding here.

I'll implement this suggestion separately too, probably next
week.

					-Alex

> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
> 
> On 10/22/2012 09:51 AM, Alex Elder wrote:
>> This adds a verification that an rbd image's object order is
>> within the upper and lower bounds supported by this implementation.
>>
>> It must be at least 9 (SECTOR_SHIFT), because the Linux bio system
>> assumes that minimum granularity.
>>
>> It also must be less than 32 (at the moment anyway) because there
>> exist spots in the code that store the size of a "segment" (object
>> backing an rbd image) in a signed int variable, which can be 32 bits
>> including the sign.  We should be able to relax this limit once
>> we've verified the code uses 64-bit types where needed.
>>
>> Note that the CLI tool already limits the order to the range 12-25.
>>
>> Signed-off-by: Alex Elder <elder@inktank.com>
>> ---
>>   drivers/block/rbd.c |   10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
>> index d032883..4734446 100644
>> --- a/drivers/block/rbd.c
>> +++ b/drivers/block/rbd.c
>> @@ -533,6 +533,16 @@ static bool rbd_dev_ondisk_valid(struct
>> rbd_image_header_ondisk *ondisk)
>>       if (memcmp(&ondisk->text, RBD_HEADER_TEXT, sizeof
>> (RBD_HEADER_TEXT)))
>>           return false;
>>
>> +    /* The bio layer requires at least sector-sized I/O */
>> +
>> +    if (ondisk->options.order < SECTOR_SHIFT)
>> +        return false;
>> +
>> +    /* If we use u64 in a few spots we may be able to loosen this */
>> +
>> +    if (ondisk->options.order > 8 * sizeof (int) - 1)
>> +        return false;
>> +
>>       /*
>>        * The size of a snapshot header has to fit in a size_t, and
>>        * that limits the number of snapshots.
>>
> 


  reply	other threads:[~2012-10-26 22:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 16:49 [PATCH 0/4] rbd: four minor changes Alex Elder
2012-10-22 16:51 ` [PATCH 1/4] rbd: verify rbd image order value Alex Elder
2012-10-22 22:43   ` Dan Mick
2012-10-24 18:02   ` Josh Durgin
2012-10-26 22:06     ` Alex Elder [this message]
2012-10-22 16:51 ` [PATCH 2/4] rbd: increase maximum snapshot name length Alex Elder
2012-10-24 19:01   ` Josh Durgin
2012-10-24 21:05   ` Dan Mick
2012-10-22 16:51 ` [PATCH 3/4] rbd: simplify rbd_merge_bvec() Alex Elder
2012-10-24 22:23   ` Dan Mick
2012-10-24 22:31     ` Josh Durgin
2012-10-22 16:51 ` [PATCH 4/4] rbd: kill rbd_device->rbd_opts Alex Elder
2012-10-24 22:30   ` Josh Durgin
2012-10-24 22:37   ` Dan Mick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=508B0949.7000906@inktank.com \
    --to=elder@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=josh.durgin@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.