]> Pileus Git - ~andy/linux/commitdiff
libceph: Allocate larger oid buffer in request msgs
authorStratos Psomadakis <psomas@grnet.gr>
Thu, 10 Nov 2011 13:45:37 +0000 (15:45 +0200)
committerSage Weil <sage@newdream.net>
Fri, 11 Nov 2011 17:50:19 +0000 (09:50 -0800)
ceph_osd_request struct allocates a 40-byte buffer for object names.
RBD image names can be up to 96 chars long (100 with the .rbd suffix),
which results in the object name for the image being truncated, and a
subsequent map failure.

Increase the oid buffer in request messages, in order to avoid the
truncation.

Signed-off-by: Stratos Psomadakis <psomas@grnet.gr>
Signed-off-by: Sage Weil <sage@newdream.net>
include/linux/ceph/osd_client.h
net/ceph/osd_client.c

index f88eacb111d4151dc5491797fe0e03faaadc26a9..7c05ac202d90650069d4713ac2e13b3be9b86024 100644 (file)
 #include "osdmap.h"
 #include "messenger.h"
 
+/* 
+ * Maximum object name size 
+ * (must be at least as big as RBD_MAX_MD_NAME_LEN -- currently 100) 
+ */
+#define MAX_OBJ_NAME_SIZE 100
+
 struct ceph_msg;
 struct ceph_snap_context;
 struct ceph_osd_request;
@@ -75,7 +81,7 @@ struct ceph_osd_request {
        struct inode *r_inode;                /* for use by callbacks */
        void *r_priv;                         /* ditto */
 
-       char              r_oid[40];          /* object name */
+       char              r_oid[MAX_OBJ_NAME_SIZE];          /* object name */
        int               r_oid_len;
        unsigned long     r_stamp;            /* send OR check time */
 
index 733e46008b89d6e67397d779edf9ccb5cb3e5c8a..f4f3f58f5234c1a5ce5eb4b54638c730f571ffb9 100644 (file)
@@ -244,7 +244,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
                ceph_pagelist_init(req->r_trail);
        }
        /* create request message; allow space for oid */
-       msg_size += 40;
+       msg_size += MAX_OBJ_NAME_SIZE;
        if (snapc)
                msg_size += sizeof(u64) * snapc->num_snaps;
        if (use_mempool)