ceph: remove the inline data support
Subsystems (2)
PATCH v3 1/1 ceph: remove the inline data support
Inline data support has been deprecated in the CephFS MDS and is being formally removed. Existing inline data can be migrated to data pool objects via MDS scrub (see PR #44359).
Add CONFIG_CEPH_FS_INLINE_DATA (default n) to gate all inline data code in the kclient. When disabled, CEPH_FEATURE_MDS_INLINE_DATA is not advertised to the MDS, which will then refuse to open files that still have inline data, returning -EPERM and preventing silent data corruption that would occur if the kclient tried to read inline data from OSD objects that do not contain it.
The conditional compilation is centralized in fs/ceph/super.h, where static inline helpers make all the inline data code compile out cleanly when the option is disabled, so that removing the option later only touches that one place. ceph_inline_version() returns CEPH_INLINE_NONE when the option is disabled, which makes every version comparison in the disabled build constant-fold to false; the stubbed out ceph_uninline_data() and ceph_fill_inline_data() are then unreachable.
The MDS still carries inline_version + inline_data on the wire, so the reply and cap grant parsers keep consuming those fields even with the option disabled, only skipping them, to keep the decode pointer in sync for the fields that follow.
This config option will be kept for a transitional period to allow existing CephFS deployments to migrate inline data via MDS scrub. Once the migration period ends, the option and all inline data code will be permanently removed.
Users upgrading from an older Ceph release should ensure all inline data has been migrated before deploying a kclient with this option disabled:
1. Enable and run MDS scrub to uninline existing data
2. Disable inline_data on the filesystem:
ceph fs set <fs> inline_data false --yes-i-really-really-mean-it
---
Changes in v3:
- addressed Viacheslav's review comments: dropped all the #ifdef
blocks from the call sites by centralizing the conditional
compilation in fs/ceph/super.h
- added ceph_inline_version() and ceph_set_inline_version()
accessors; with the option disabled the getter returns
CEPH_INLINE_NONE so every version comparison constant-folds to
false
- added no-op stubs for ceph_uninline_data() and
ceph_fill_inline_data() so their callers don't need to be #ifdef'd
- parsed the inline fields in the reply inode and cap grant messages
via parse_reply_info_inline_data() and parse_inline_data()
helpers, which skip the fields with the option disabled to keep
the decode pointer in sync (also renamed __len to len)
- defined CEPH_STAT_CAP_INLINE_DATA as 0 with the option disabled
instead of #ifdef'ing the getattr masks at the call sites
- renamed CEPH_FEATURE_MDS_INLINE_DATA_DEFAULT to CEPH_FEATURE_MDS_INLINE_DATA_SUPPORTED and moved it next to CEPH_FEATURES_SUPPORTED_DEFAULT
- only i_inline_version keeps its #ifdef; the other inline data
fields stay unconditional, since the helpers make them dead code
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- keep CEPH_FEATURE_MDS_INLINE_DATA always defined as (1ULL << 40)
so decode logic can still check MDS feature bits; gate the
supported features set via CEPH_FEATURE_MDS_INLINE_DATA_DEFAULT
- Link to v1: https://patch.msgid.link/[email protected]
To: Ilya Dryomov <[email protected]>
To: Alex Markuze <[email protected]>
To: Viacheslav Dubeyko <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- fs/ceph/Kconfig | 12 ++++++++ fs/ceph/addr.c | 13 +++++++-- fs/ceph/caps.c | 42 +++++++++++++++++++++------ fs/ceph/inode.c | 6 ++-- fs/ceph/mds_client.c | 45 ++++++++++++++++++++++------- fs/ceph/snap.c | 2 +- fs/ceph/super.h | 59 ++++++++++++++++++++++++++++++++++---- include/linux/ceph/ceph_features.h | 14 ++++++++- include/linux/ceph/ceph_fs.h | 5 ++++ 9 files changed, 166 insertions(+), 32 deletions(-)
fs/ceph/Kconfig +12 -0
@@ -17,6 +17,18 @@ config CEPH_FS If unsure, say N. if CEPH_FS +config CEPH_FS_INLINE_DATA + bool "Enable CephFS inline data support (deprecated)" + depends on CEPH_FS + default n + help + Inline data support has been deprecated in the CephFS MDS + and is being formally removed. Existing inline data can be + migrated to data pool objects via MDS scrub. Choose N + unless you have a legacy filesystem that requires it, + and ensure all inline data has been migrated (see + ceph fs set <fs> inline_data false) before enabling. + config CEPH_FSCACHE bool "Enable Ceph client caching support" depends on CEPH_FS=m && FSCACHE || CEPH_FS=y && FSCACHE=y
fs/ceph/addr.c +11 -2
@@ -275,6 +275,7 @@ static void finish_netfs_read(struct ceph_osd_request *req)ceph_dec_osd_stopping_blocker (fsc->mdsc); } +#ifdef CONFIG_CEPH_FS_INLINE_DATA static bool ceph_netfs_issue_op_inline (struct netfs_io_subrequest *subreq) {struct netfs_io_request *rreq = subreq->rreq;
@@ -336,6 +337,12 @@ static bool ceph_netfs_issue_op_inline(struct netfs_io_subrequest *subreq)netfs_read_subreq_terminated (subreq); return true; } +#else +static bool ceph_netfs_issue_op_inline (struct netfs_io_subrequest *subreq) +{ +return false; +} +#endif /* CONFIG_CEPH_FS_INLINE_DATA */ static int ceph_netfs_prepare_read (struct netfs_io_subrequest *subreq) {
@@ -2195,6 +2202,7 @@ static vm_fault_t ceph_page_mkwrite(struct vm_fault *vmf)return ret; } +#ifdef CONFIG_CEPH_FS_INLINE_DATA void ceph_fill_inline_data (struct inode *inode,struct page *locked_page,char *data,size_t len) {
@@ -2258,7 +2266,7 @@ int ceph_uninline_data(struct file *file)u64 len;spin_lock (&ci->i_ceph_lock); - inline_version = ci->i_inline_version; + inline_version =ceph_inline_version (ci);spin_unlock (&ci->i_ceph_lock); doutc(cl, "%llx.%llx inline_version %llu\n", ceph_vinop(inode),
@@ -2374,7 +2382,7 @@ int ceph_uninline_data(struct file *file)/* Set to CAP_INLINE_NONE and dirty the caps */ down_read (&fsc->mdsc->snap_rwsem);spin_lock (&ci->i_ceph_lock); - ci->i_inline_version =CEPH_INLINE_NONE ; +ceph_set_inline_version (ci,CEPH_INLINE_NONE ); dirty =__ceph_mark_dirty_caps (ci,CEPH_CAP_FILE_WR , &prealloc_cf);spin_unlock (&ci->i_ceph_lock);up_read (&fsc->mdsc->snap_rwsem);
@@ -2397,6 +2405,7 @@ int ceph_uninline_data(struct file *file) ceph_vinop(inode), inline_version, err);return err; } +#endif /* CONFIG_CEPH_FS_INLINE_DATA */ static const struct vm_operations_struct ceph_vmops = { .fault = ceph_filemap_fault,
fs/ceph/caps.c +33 -9
73 lines not on this page · raw message
fs/ceph/inode.c +3 -3
@@ -627,7 +627,7 @@ struct inode *ceph_alloc_inode(struct super_block *sb)spin_lock_init (&ci->i_ceph_lock); ci->i_version =0 ; - ci->i_inline_version =0 ; +ceph_set_inline_version (ci,0 ); ci->i_time_warp_seq =0 ; ci->i_ceph_flags =0 ;atomic64_set (&ci->i_ordered_count,1 );
@@ -1363,9 +1363,9 @@ int ceph_fill_inode(struct inode *inode, struct page *locked_page, }if (iinfo->inline_version >0 && - iinfo->inline_version >= ci->i_inline_version) { + iinfo->inline_version >=ceph_inline_version (ci)) {int cache_caps =CEPH_CAP_FILE_CACHE |CEPH_CAP_FILE_LAZYIO ; - ci->i_inline_version = iinfo->inline_version; +ceph_set_inline_version (ci, iinfo->inline_version);if (ceph_has_inline_data (ci) && (locked_page || (info_caps & cache_caps))) fill_inline = true;
fs/ceph/mds_client.c +34 -11
64 lines not on this page · raw message
fs/ceph/snap.c +1 -1
@@ -613,7 +613,7 @@ static void ceph_queue_cap_snap(struct ceph_inode_info *ci, capsnap->xattr_version =0 ; } - capsnap->inline_data = ci->i_inline_version !=CEPH_INLINE_NONE ; + capsnap->inline_data =ceph_inline_version (ci) !=CEPH_INLINE_NONE ;/* dirty page count moved from _head to this cap_snap; all subsequent writes page dirties occur _after_ this
fs/ceph/super.h +54 -5
84 lines not on this page · raw message
include/linux/ceph/ceph_features.h +13 -1
@@ -173,6 +173,18 @@ DEFINE_CEPH_FEATURE(62, 1, RESERVED) // do not use; used as a sentinalDEFINE_CEPH_FEATURE_DEPRECATED (63 ,1 ,RESERVED_BROKEN ,LUMINOUS )// client-facing +/* +* Only advertise CEPH_FEATURE_MDS_INLINE_DATA when inline data support is +* built in. Without it the MDS refuses to hand out files that still have +* inline data instead of letting the client read the data pool objects +* that do not hold it yet. + */ +#ifdef CONFIG_CEPH_FS_INLINE_DATA +#define CEPH_FEATURE_MDS_INLINE_DATA_SUPPORTED CEPH_FEATURE_MDS_INLINE_DATA +#else +#define CEPH_FEATURE_MDS_INLINE_DATA_SUPPORTED 0 +#endif +/* * Features supported. */
@@ -204,7 +216,7 @@ DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facinCEPH_FEATURE_CRUSH_V2 | \CEPH_FEATURE_EXPORT_PEER | \CEPH_FEATURE_OSDMAP_ENC | \ -CEPH_FEATURE_MDS_INLINE_DATA | \ +CEPH_FEATURE_MDS_INLINE_DATA_SUPPORTED |\CEPH_FEATURE_CRUSH_TUNABLES3 | \CEPH_FEATURE_OSD_PRIMARY_AFFINITY | \ CEPH_FEATURE_MSGR_KEEPALIVE2 | \
include/linux/ceph/ceph_fs.h +5 -0
@@ -707,8 +707,13 @@ int ceph_flags_to_mode(int flags); CEPH_CAP_LINK_SHARED | \ CEPH_CAP_FILE_SHARED | \ CEPH_CAP_XATTR_SHARED) +#ifdef CONFIG_CEPH_FS_INLINE_DATA #define CEPH_STAT_CAP_INLINE_DATA (CEPH_CAP_FILE_SHARED | \ CEPH_CAP_FILE_RD) +#else +/* no inline data to fetch, so no extra caps are needed for it */ +#define CEPH_STAT_CAP_INLINE_DATA 0 +#endif #define CEPH_STAT_RSTAT CEPH_CAP_FILE_WREXTEND#define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \
---
base-commit: 86f405187248b7a5a2104eba07f941d27593893e
change-id: 20260728-b4-ceph-remove-inline-data-d55c6466dd7e
Best regards,
Signature · 1 line
Xiubo Li <[email protected]>
Hi Xiubo,
Thanks for the patch.
Signature · 1 line
Alex Markuze