]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd/cache: Fix scoping issue with lambda capture renaming
authorWillem Jan Withagen <wjw@digiware.nl>
Wed, 5 Aug 2020 19:04:11 +0000 (19:04 +0000)
committerWillem Jan Withagen <wjw@digiware.nl>
Thu, 6 Aug 2020 16:16:18 +0000 (16:16 +0000)
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<librbd::ImageCtx>::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<librbd::ImageCtx>::read' requested here
template class librbd::cache::ParentCacheObjectDispatch<librbd::ImageCtx>;
                              ^
/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<librbd::ImageCtx>::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 <wjw@digiware.nl>
src/librbd/cache/ParentCacheObjectDispatch.cc

index 7e3823481fd4609338986c38e09b2991d1c65d8f..4ca8212516ed2efc9def34f0e25a2e418dbcee35 100644 (file)
@@ -94,8 +94,9 @@ bool ParentCacheObjectDispatch<I>::read(
 
   CacheGenContextURef ctx = make_gen_lambda_context<ObjectCacheRequest*,
                                      std::function<void(ObjectCacheRequest*)>>
-   ([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);