From ce8ecd39f17126012fcb5cd3d9e094ea4994cee6 Mon Sep 17 00:00:00 2001 From: izxl007 Date: Sun, 27 Jul 2025 00:18:37 +0800 Subject: [PATCH] mds: fix ineffective 'false' parameter due to virtual inheritance In MDCacheIOContext subclasses, the track parameter, when set to false, is ignored due to C++ virtual inheritance. Only the most-derived class can initialize virtual bases. This commit ensures all subclasses adopt the default track = true, eliminating confusion and potential errors from non-functional constructor parameters. Signed-off-by: izxl007 --- src/mds/MDCache.cc | 4 ++-- src/mds/MDCache.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 3a8c47391228a..f6010c0fe40eb 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6657,7 +6657,7 @@ struct C_IO_MDC_TruncateWriteFinish : public MDCacheIOContext { LogSegmentRef ls; uint32_t block_size; C_IO_MDC_TruncateWriteFinish(MDCache *c, CInode *i, LogSegmentRef const& l, uint32_t bs) : - MDCacheIOContext(c, false), in(i), ls(l), block_size(bs) { + MDCacheIOContext(c), in(i), ls(l), block_size(bs) { } void finish(int r) override { ceph_assert(r == 0 || r == -ENOENT); @@ -6672,7 +6672,7 @@ struct C_IO_MDC_TruncateFinish : public MDCacheIOContext { CInode *in; LogSegmentRef ls; C_IO_MDC_TruncateFinish(MDCache *c, CInode *i, LogSegmentRef const& l) : - MDCacheIOContext(c, false), in(i), ls(l) { + MDCacheIOContext(c), in(i), ls(l) { } void finish(int r) override { ceph_assert(r == 0 || r == -ENOENT); diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 62abf99e45e3f..100a845ea9e39 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -1614,7 +1614,7 @@ private: * it'ls the lesser of two evils compared with introducing * yet another piece of (multiple) inheritance. */ -class MDCacheIOContext : public virtual MDSIOContextBase { +class MDCacheIOContext : public MDSIOContextBase { protected: MDCache *mdcache; MDSRank *get_mds() override -- 2.39.5