• Alex Elder's avatar
    rbd: don't take extra bio reference for osd client · 1e32d34c
    Alex Elder authored
    Currently, if the OSD client finds an osd request has had a bio list
    attached to it, it drops a reference to it (or rather, to the first
    entry on that list) when the request is released.
    
    The code that added that reference (i.e., the rbd client) is
    therefore required to take an extra reference to that first bio
    structure.
    
    The osd client doesn't really do anything with the bio pointer other
    than transfer it from the osd request structure to outgoing (for
    writes) and ingoing (for reads) messages.  So it really isn't the
    right place to be taking or dropping references.
    
    Furthermore, the rbd client already holds references to all bio
    structures it passes to the osd client, and holds them until the
    request is completed.  So there's no need for this extra reference
    whatsoever.
    
    So remove the bio_put() call in ceph_osdc_release_request(), as
    well as its matching bio_get() call in rbd_osd_req_create().
    
    This change could lead to a crash if old libceph.ko was used with
    new rbd.ko.  Add a compatibility check at rbd initialization time to
    avoid this possibilty.
    
    This resolves:
        http://tracker.ceph.com/issues/3798    and
        http://tracker.ceph.com/issues/3799Signed-off-by: default avatarAlex Elder <elder@inktank.com>
    Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
    1e32d34c
ceph_common.c 14.4 KB