]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd: call user completion after incrementing perfcounters
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 27 Dec 2013 01:38:52 +0000 (17:38 -0800)
committerJosh Durgin <josh.durgin@inktank.com>
Mon, 30 Dec 2013 17:22:13 +0000 (09:22 -0800)
commit2f25bfeaaff7a9a4914aa55fac6d14c6a3f84d2f
tree0c78266b21d26218162e97661d5eed18380f40a2
parentd97f4ed37a6afc8e8c58381eda28a2c5e286b0a2
librbd: call user completion after incrementing perfcounters

The perfcounters (and the ictx) are only valid while the image is
still open.  If the librbd user gets the callback for its last I/O,
then closes the image, the ictx and its perfcounters will be
invalid. If the AioCompletion object is has not run the rest of its
complete() method yet, it will access these now-invalid addresses,
possibly leading to a crash.

The AioCompletion object is independent of the ictx and does not
access it again after incrementing perfcounters, so avoid this race by
calling the user's callback after this step. The AioCompletion object
will be cleaned up by the rest of complete_request(), independent of
the ImageCtx.

Fixes: #5426
Backport: dumpling, emperor
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
(cherry picked from commit 4cea7895da7331b84d8c6079851fdc0ff2f4afb1)
src/librbd/AioCompletion.h