Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

rbd: use the correct length for format 2 object names

Format 2 objects use 16 characters for the object name suffix to be
able to express the full 64-bit range of object numbers. Format 1
images only use 12 characters for this. Using 12-character names for
format 2 caused userspace and kernel rbd clients to read differently
named objects, which made an image written by one client look empty to
the other client.

CC: stable@vger.kernel.org # 3.9+
Reported-by: Chris Dunlop <chris@onthe.net.au>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>

authored by

Josh Durgin and committed by
Sage Weil
3a96d5cd 3abef3b3

+5 -1
+5 -1
drivers/block/rbd.c
··· 1038 1038 char *name; 1039 1039 u64 segment; 1040 1040 int ret; 1041 + char *name_format; 1041 1042 1042 1043 name = kmem_cache_alloc(rbd_segment_name_cache, GFP_NOIO); 1043 1044 if (!name) 1044 1045 return NULL; 1045 1046 segment = offset >> rbd_dev->header.obj_order; 1046 - ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, "%s.%012llx", 1047 + name_format = "%s.%012llx"; 1048 + if (rbd_dev->image_format == 2) 1049 + name_format = "%s.%016llx"; 1050 + ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, name_format, 1047 1051 rbd_dev->header.object_prefix, segment); 1048 1052 if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) { 1049 1053 pr_err("error formatting segment name for #%llu (%d)\n",