Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Jun 2013 16:27:40 +0000 (06:27 -1000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Jun 2013 16:27:40 +0000 (06:27 -1000)
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

1  2 
drivers/block/rbd.c

diff --combined drivers/block/rbd.c
@@@ -497,7 -497,7 +497,7 @@@ static int rbd_open(struct block_devic
        return 0;
  }
  
 -static int rbd_release(struct gendisk *disk, fmode_t mode)
 +static void rbd_release(struct gendisk *disk, fmode_t mode)
  {
        struct rbd_device *rbd_dev = disk->private_data;
        unsigned long open_count_before;
        mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
        put_device(&rbd_dev->dev);
        mutex_unlock(&ctl_mutex);
 -
 -      return 0;
  }
  
  static const struct block_device_operations rbd_bd_ops = {
@@@ -1036,12 -1038,16 +1036,16 @@@ static const char *rbd_segment_name(str
        char *name;
        u64 segment;
        int ret;
+       char *name_format;
  
        name = kmem_cache_alloc(rbd_segment_name_cache, GFP_NOIO);
        if (!name)
                return NULL;
        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);
        if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) {
                pr_err("error formatting segment name for #%llu (%d)\n",
@@@ -1194,7 -1200,7 +1198,7 @@@ static struct bio *bio_clone_range(stru
        /* Find first affected segment... */
  
        resid = offset;
 -      __bio_for_each_segment(bv, bio_src, idx, 0) {
 +      bio_for_each_segment(bv, bio_src, idx) {
                if (resid < bv->bv_len)
                        break;
                resid -= bv->bv_len;