]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
librbd/cache/pwl: avoid stack overflow caused by nested shared_ptr destruction
authorHualong Feng <hualong.feng@intel.com>
Fri, 2 Jul 2021 06:22:06 +0000 (14:22 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 6 Aug 2021 19:43:43 +0000 (21:43 +0200)
commite706b9db5c5d79366c5167d01ad46e13f8500936
tree2941f258d96a964c19a3d6586255ecd620e92b33
parentb9922213426de519d963c2b96ea3377806185e92
librbd/cache/pwl: avoid stack overflow caused by nested shared_ptr destruction

Destruction of nested shared_ptr will cause stack overflow.
With the explicit assignment of nullptr, the deleted node
is completely disconnected from the current linked list

-------              *******               -------
|sync | <--earlier-- |sync | <--earlier-x- |sync |
|point| --later----> |point| --later----x> |point|
-------              *******               -------
   |                    |                     |
   V                    V                     V
-------              -------               -------
|log_ | ---next----> |log_ | ---next----x> |log_ |
|entry|              |entry|               |entry|
-------              -------               -------

earlier: earlier_sync_point
later:   later_sync_point
next:    next_sync_point_entry

Fixes: https://tracker.ceph.com/issues/51418
Signed-off-by: Feng Hualong <hualong.feng@intel.com>
src/librbd/cache/pwl/LogOperation.cc