]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
crimson: fix dangling ClientRequest::this pointer. 39093/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 26 Jan 2021 21:54:20 +0000 (22:54 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 26 Jan 2021 22:26:51 +0000 (23:26 +0100)
commit00ccde23ef894c7a024d3db5cf5886ed5e9572a9
tree1394859c36f59addf126e2673fe236275d26fb83
parent72cc819b3aa47cdb684577be1f33021aa9fd2faf
crimson: fix dangling ClientRequest::this pointer.

`ShardServices::start_operation<T>()` spawns an operation,
calls `start()` on it and returns a future plus a smart
pointer controlling its life-time. Callers are responsible
to ensure the pointer doesn't go out-of-scope before
the entire execution is finished. This is error-prone.

`OSD::handle_osd_op()` forgets about its responsibility
which results in dangling `this` pointer of `ClientRequest`.
I believe the problem is much wider spread and the class
is just the tip of the iceberg.

In this commit `start_operation<T>()` is altered to extend
the life-time a bit. However, this isn't an ultimate solution
as callers are still able to e.g. put extra `this`-catching
lambdas on the returned future. A new `with_operation<T>()`-
like interface is expected as a follow-up.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/shard_services.h