Re: ceph v6.1, rbd-fuse issue, rbd_list: error %d Numerical result out of range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sean:

It looks to me like this is the result of the simple-minded[1] strategy for allocating a return buffer for rbd_list():

        ibuf_len = 1024;
        ibuf = malloc(ibuf_len);
        actual_len = rbd_list(ioctx, ibuf, &ibuf_len);
        if (actual_len < 0) {
                simple_err("rbd_list: error %d\n", actual_len);
                return;
        }

An easy fix would be to catch the actual_len < 0 case and reallocate ibuf with the returned ibuf_len size.

I also note that ibuf is never freed, which is not great. In fact that whole enumerate_images() routine is not what you'd call very solid. Here's a mostly-untested patch you can try if you like (I'll test tomorrow):

diff --git a/src/rbd_fuse/rbd-fuse.c b/src/rbd_fuse/rbd-fuse.c
index 5a4bfe2..5411ff8 100644
--- a/src/rbd_fuse/rbd-fuse.c
+++ b/src/rbd_fuse/rbd-fuse.c
@@ -93,8 +93,13 @@ enumerate_images(struct rbd_image **head)
        ibuf = malloc(ibuf_len);
        actual_len = rbd_list(ioctx, ibuf, &ibuf_len);
        if (actual_len < 0) {
-               simple_err("rbd_list: error %d\n", actual_len);
-               return;
+               /* ibuf_len now set to required length */
+               actual_len = rbd_list(ioctx, ibuf, &ibuf_len);
+               if (actual_len < 0) {
+                       /* shouldn't happen */
+                       simple_err("rbd_list:", actual_len);
+                       return;
+               }
        }

        fprintf(stderr, "pool %s: ", pool_name);
@@ -102,10 +107,11 @@ enumerate_images(struct rbd_image **head)
             ip += strlen(ip) + 1)  {
                fprintf(stderr, "%s, ", ip);
                im = malloc(sizeof(*im));
-               im->image_name = ip;
+               im->image_name = strdup(ip);
                im->next = *head;
                *head = im;
        }
+       free(ibuf);
        fprintf(stderr, "\n");
        return;
 }


--
[1] it was my simple mind...



On 05/17/2013 02:34 AM, Sean wrote:
Hi everyone

The image files don't display in mount point when using the command
"rbd-fuse -p poolname -c /etc/ceph/ceph.conf /aa"

but other pools can display image files with the same command. I also create
more sizes and more numbers images than that pool, it's work fine.

How can I track the issue?

It reports the below errors after enabling debug output of Fuse options.

root@ceph3:/# rbd-fuse -p qa_vol /aa -d
FUSE library version: 2.8.6
nullpath_ok: 0
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56
INIT: 7.17
flags=0x0000047b
max_readahead=0x00020000
    INIT: 7.12
    flags=0x00000031
    max_readahead=0x00020000
    max_write=0x00020000
    unique: 1, success, outsize: 40
unique: 2, opcode: GETATTR (3), nodeid: 1, insize: 56
getattr /
rbd_list: error %d
: Numerical result out of range
    unique: 2, success, outsize: 120
unique: 3, opcode: OPENDIR (27), nodeid: 1, insize: 48
opendir flags: 0x98800 /
rbd_list: error %d
: Numerical result out of range
    opendir[0] flags: 0x98800 /
    unique: 3, success, outsize: 32
unique: 4, opcode: READDIR (28), nodeid: 1, insize: 80
readdir[0] from 0
    unique: 4, success, outsize: 80
unique: 5, opcode: READDIR (28), nodeid: 1, insize: 80
    unique: 5, success, outsize: 16
unique: 6, opcode: RELEASEDIR (29), nodeid: 1, insize: 64
releasedir[0] flags: 0x0
    unique: 6, success, outsize: 16


thanks.
Sean Cao


_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com


--
Dan Mick, Filesystem Engineering
Inktank Storage, Inc.	http://inktank.com
Ceph docs: http://ceph.com/docs
_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com




[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux