提交 7ecba6f2 编写于 作者: L Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client

Pull Ceph fix from Sage Weil:
 "This fixes a problem preventing the kernel and userland librbd
  libraries from sharing data with the new format 2 images"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
  rbd: use the correct length for format 2 object names
...@@ -1036,12 +1036,16 @@ static const char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset) ...@@ -1036,12 +1036,16 @@ static const char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset)
char *name; char *name;
u64 segment; u64 segment;
int ret; int ret;
char *name_format;
name = kmem_cache_alloc(rbd_segment_name_cache, GFP_NOIO); name = kmem_cache_alloc(rbd_segment_name_cache, GFP_NOIO);
if (!name) if (!name)
return NULL; return NULL;
segment = offset >> rbd_dev->header.obj_order; segment = offset >> rbd_dev->header.obj_order;
ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, "%s.%012llx", name_format = "%s.%012llx";
if (rbd_dev->image_format == 2)
name_format = "%s.%016llx";
ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, name_format,
rbd_dev->header.object_prefix, segment); rbd_dev->header.object_prefix, segment);
if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) { if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) {
pr_err("error formatting segment name for #%llu (%d)\n", pr_err("error formatting segment name for #%llu (%d)\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册