OSDN Git Service

rbd: don't leak rbd_req on synchronous requests
authorAlex Elder <elder@inktank.com>
Fri, 30 Nov 2012 15:59:47 +0000 (09:59 -0600)
committerAlex Elder <elder@inktank.com>
Thu, 17 Jan 2013 22:34:58 +0000 (16:34 -0600)
commit2e53c6c379b65372df21f4d6019f6eb63af81384
tree8ce8eff65955717f60c9185b86351333d5fd37e0
parent907703d050df92979b3848ee42f88d5c9c6c13fe
rbd: don't leak rbd_req on synchronous requests

When rbd_do_request() is called it allocates and populates an
rbd_req structure to hold information about the osd request to be
sent.  This is done for the benefit of the callback function (in
particular, rbd_req_cb()), which uses this in processing when
the request completes.

Synchronous requests provide no callback function, in which case
rbd_do_request() waits for the request to complete before returning.
This case is not handling the needed free of the rbd_req structure
like it should, so it is getting leaked.

Note however that the synchronous case has no need for the rbd_req
structure at all.  So rather than simply freeing this structure for
synchronous requests, just don't allocate it to begin with.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c