All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@ieee.org>
To: "Ilya Dryomov" <idryomov@gmail.com>,
	"Bartłomiej Święcki" <bartlomiej.swiecki@corp.ovh.com>
Cc: Ceph Development <ceph-devel@vger.kernel.org>
Subject: Re: RBD image name constraints
Date: Fri, 8 Apr 2016 12:36:38 -0500	[thread overview]
Message-ID: <5707EC26.4000909@ieee.org> (raw)
In-Reply-To: <CAOi1vP_MPeS8n7_rMnufeFPMU2=sy3vudOjDonZ=Gk+dHKuGCg@mail.gmail.com>

On 04/08/2016 11:13 AM, Ilya Dryomov wrote:
> On Fri, Apr 8, 2016 at 2:23 PM, Bartłomiej Święcki
> <bartlomiej.swiecki@corp.ovh.com> wrote:
>> Hi,
>>
>> What are constraints regarding names of RBD images? I tried to look it up
>> but without success.
> 
> I'm afraid this is something nobody ever paid enough attention to.
> 
>>
>> My tests show that maximum length is about 4089 bytes and the only forbidden
>> characters are '\0' and '@' but didn't get deep enough into the code to
>> figure out the length limit. Are my findings correct?
> 
> There is an old define in the code base, but it's not enforced:
> 
>     #define RBD_MAX_IMAGE_NAME_SIZE 96

On the kernel RBD client we have RBD_IMAGE_NAME_LEN_MAX,
which is 4093 bytes.  That is because the RBD "dir_get_name"
object method returns an encoded string, which consists of a
32-byte name length followed by the name.  We place the result
into a buffer which has room for a terminating NUL character.
This length value was used to limit the buffer size to a 4KB
page or less.  I haven't checked but I'm pretty sure the request
fails of the name is larger than that.

It does not surprise me that there are other limits that are
more restrictive than that.  The one you're referring to below
appears to be CEPH_MAX_OID_NAME_LEN.

> The kernel client, however, won't process object requests with names
> bigger than 100 chars.  Lifting this limitation wouldn't be hard, but
> so far I've only seen this raised once, by Jean-Tiare Le Bigot, also
> from OVH.
> 
> Currently, with no enforcement from librbd, this comes down to how big
> RADOS object names can be, which depends on config options and even the
> choice of the data store - in case of ext4, you wouldn't get ~4k, for
> example.

Honestly I don't think there's much need for anything legitimate
beyond about 100 characters, but it is important to test the
limits, whatever they are.

					-Alex

> 
>>
>> I also think I've found a regression introduced in v10.0.1 regarding pool /
>> image name constraints (introduced in
>> fa4e00f8c85603ed202bfef2f3be6086482fbbb2).
>>
>> In newer versions there's regex that's parsing image name passed to rbd
>> command (in src/tools/rbd/Utils.cc, function: extract_spec):
>>
>>     "^(?:([^/@]+)/)?([^/@]+)(?:@([^/@]+))?$"
>>
>> It won't parse pool name with '@', image name with '/' nor snapshot name
>> with '/', which was allowed in previous implementation based on strchr.
> 
> "spec" is a combination of pool, image and snapshot names:
> 
>     [pool/]image[@snap] # pool and snap are optional
> 
> I haven't looked at either of the versions in detail, but you can see
> how an image name with a '/' in it is a problem.
> 
> Would you mind sharing some details on what you are doing?  If you have
> a layer of management software on top, it wouldn't be a bad idea to
> restrict things to a basic A-Za-z0-9+= or so and 96 chars in length.
> 
> Thanks,
> 
>                 Ilya
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-04-08 17:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08 12:23 RBD image name constraints Bartłomiej Święcki
2016-04-08 16:13 ` Ilya Dryomov
2016-04-08 17:36   ` Alex Elder [this message]
2016-04-08 18:12     ` Ilya Dryomov
2016-04-11  8:45   ` Bartłomiej Święcki
2016-04-08 20:29 ` Mykola Golub
2016-04-11  8:45   ` Bartłomiej Święcki
2016-04-11  9:37     ` Mykola Golub
2016-04-11 14:29       ` Jason Dillaman
2016-04-11 15:08         ` Ilya Dryomov
2016-04-12 12:32           ` Bartłomiej Święcki
2016-04-12 12:47             ` Wido den Hollander
2016-04-12 13:01               ` Jason Dillaman
2016-04-12 13:23                 ` Ilya Dryomov

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=5707EC26.4000909@ieee.org \
    --to=elder@ieee.org \
    --cc=bartlomiej.swiecki@corp.ovh.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.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.