[Bugs] [Bug 1559794] weighted-rebalance

bugzilla at redhat.com bugzilla at redhat.com
Thu May 17 12:14:22 UTC 2018


https://bugzilla.redhat.com/show_bug.cgi?id=1559794

Raghavendra G <rgowdapp at redhat.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|needinfo?(rgowdapp at redhat.c |
                   |om)                         |



--- Comment #45 from Raghavendra G <rgowdapp at redhat.com> ---
(In reply to Cnaik from comment #44)
> (In reply to Raghavendra G from comment #41)
> > Encoding of readdir response is a recursive function. The depth of the stack
> > is directly proportional to the number of dentries in a readdir response.
> > So, it can result in stack overflow if readdir happen to have too many
> > dentries. A safer alternative would be to make this function iterative.
> 
> Could you please let us know the function to be made iterative?
> 
> We tried making gfx_defrag_fix_layout() recursive function to iterative -
> still the test behavior is same.
> Brick goes down before syncop_readdirp(called in while loop) returns in the
> second call to gfx_defrag_fix_layout

Sorry. The code is autogenerated. Autogeneration logic refers to the template
of readdirp-response from ./rpc/xdr/src/glusterfs[3][4]xdr.x

struct gfs3_readdirp_rsp {
       int op_ret;
       int op_errno;
       gfs3_dirplist *reply;
        opaque   xdata<>; /* Extra data */
};

Note that definition of gfs3_dirplist has a pointer to another object of
gfs3_dirplist - nextentry:


struct gfs3_dirplist {
       u_quad_t d_ino;
       u_quad_t d_off;
       unsigned int d_len;
       unsigned int d_type;
       string name<>;
       gf_iatt stat;
       opaque dict<>;
       gfs3_dirplist *nextentry;
};

Autogenerated code from ./rpc/xdr/src/glustersf[3][4]xdr.c:
bool_t
xdr_gfs3_readdirp_rsp (XDR *xdrs, gfs3_readdirp_rsp *objp)
{
        register int32_t *buf;

         if (!xdr_int (xdrs, &objp->op_ret))
                 return FALSE;
         if (!xdr_int (xdrs, &objp->op_errno))
                 return FALSE;
         if (!xdr_pointer (xdrs, (char **)&objp->reply, sizeof (gfs3_dirplist),
(xdrproc_t) xdr_gfs3_dirplist))
                 return FALSE;
         if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *)
&objp->xdata.xdata_len, ~0))
                 return FALSE;
        return TRUE;
}


Definition of xdr_gfs3_dirplist invokes itself to encode/decode the next dentry
in the list:
bool_t
xdr_gfs3_dirplist (XDR *xdrs, gfs3_dirplist *objp)
{
        register int32_t *buf;

         if (!xdr_u_quad_t (xdrs, &objp->d_ino))
                 return FALSE;
         if (!xdr_u_quad_t (xdrs, &objp->d_off))
                 return FALSE;
         if (!xdr_u_int (xdrs, &objp->d_len))
                 return FALSE;
         if (!xdr_u_int (xdrs, &objp->d_type))
                 return FALSE;
         if (!xdr_string (xdrs, &objp->name, ~0))
                 return FALSE;
         if (!xdr_gf_iatt (xdrs, &objp->stat))
                 return FALSE;
         if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *)
&objp->dict.dict_len, ~0))
                 return FALSE;
         if (!xdr_pointer (xdrs, (char **)&objp->nextentry, sizeof
(gfs3_dirplist), (xdrproc_t) xdr_gfs3_dirplist))
                 return FALSE;
        return TRUE;
}

if (!xdr_pointer (xdrs, (char **)&objp->nextentry, sizeof (gfs3_dirplist),
(xdrproc_t) xdr_gfs3_dirplist)) is the recursive invocation.

Since, this code is autogenerated, I am still thinking how to make this
iterative.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list