From: Willem Jan Withagen Date: Wed, 5 Aug 2020 19:04:11 +0000 (+0000) Subject: librbd/cache: Fix scoping issue with lambda capture renaming X-Git-Tag: wip-pdonnell-testing-20200918.022351~426^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=678a3154c8f0bae41a62cae7e4ebb0313269e11a;p=ceph-ci.git librbd/cache: Fix scoping issue with lambda capture renaming Clang complains: /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:97:66: error: 'object_off' in capture list does not name a variable ([this, read_data, dispatch_result, on_dispatched, object_no, object_off, ^ /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:98:6: error: 'object_len' in capture list does not name a variable object_len, snap_id, &parent_trace](ObjectCacheRequest* ack) { ^ /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:99:41: error: reference to local binding 'object_off' declared in enclosing function 'librbd::cache::ParentCacheObjectDispatch::read' handle_read_cache(ack, object_no, object_off, object_len, snap_id, ^ /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:81:9: note: 'object_off' declared here auto [object_off, object_len] = extents.front(); ^ /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:99:53: error: reference to local binding 'object_len' declared in enclosing function 'librbd::cache::ParentCacheObjectDispatch::read' handle_read_cache(ack, object_no, object_off, object_len, snap_id, ^ /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:81:21: note: 'object_len' declared here auto [object_off, object_len] = extents.front(); ^ /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:99:41: error: reference to local binding 'object_off' declared in enclosing function 'librbd::cache::ParentCacheObjectDispatch::read' handle_read_cache(ack, object_no, object_off, object_len, snap_id, ^ /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:242:31: note: in instantiation of member function 'librbd::cache::ParentCacheObjectDispatch::read' requested here template class librbd::cache::ParentCacheObjectDispatch; ^ /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:81:9: note: 'object_off' declared here auto [object_off, object_len] = extents.front(); ^ /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:99:53: error: reference to local binding 'object_len' declared in enclosing function 'librbd::cache::ParentCacheObjectDispatch::read' handle_read_cache(ack, object_no, object_off, object_len, snap_id, ^ /home/jenkins/workspace/ceph-master-compile/src/librbd/cache/ParentCacheObjectDispatch.cc:81:21: note: 'object_len' declared here auto [object_off, object_len] = extents.front(); ^ 6 errors generated. fixes: https://github.com/ceph/ceph/pull/36145 Signed-off-by: Willem Jan Withagen --- diff --git a/src/librbd/cache/ParentCacheObjectDispatch.cc b/src/librbd/cache/ParentCacheObjectDispatch.cc index 7e3823481fd..4ca8212516e 100644 --- a/src/librbd/cache/ParentCacheObjectDispatch.cc +++ b/src/librbd/cache/ParentCacheObjectDispatch.cc @@ -94,8 +94,9 @@ bool ParentCacheObjectDispatch::read( CacheGenContextURef ctx = make_gen_lambda_context> - ([this, read_data, dispatch_result, on_dispatched, object_no, object_off, - object_len, snap_id, &parent_trace](ObjectCacheRequest* ack) { + ([this, read_data, dispatch_result, on_dispatched, object_no, + object_off = object_off, object_len = object_len, snap_id, &parent_trace] + (ObjectCacheRequest* ack) { handle_read_cache(ack, object_no, object_off, object_len, snap_id, parent_trace, read_data, dispatch_result, on_dispatched);