ceph: handle InodeStat v8 versioned field in reply parsing

Add forward-compatible handling for the new versioned field introduced
in InodeStat v8. This patch only skips the field without using it,
preparing for future protocol extensions.

The v8 encoding adds a versioned sub-structure that needs to be properly
decoded and skipped to maintain compatibility with newer MDS versions.

Signed-off-by: Alex Markuze <amarkuze@redhat.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Alex Markuze 2026-02-10 09:06:24 +00:00 committed by Ilya Dryomov
parent 1c439de70b
commit e58103caff

View File

@ -232,6 +232,26 @@ static int parse_reply_info_in(void **p, void *end,
info->fscrypt_file_len, bad);
}
}
/*
* InodeStat encoding versions:
* v1-v7: various fields added over time
* v8: added optmetadata (versioned sub-structure containing
* optional inode metadata like charmap for case-insensitive
* filesystems). The kernel client doesn't support
* case-insensitive lookups, so we skip this field.
* v9: added subvolume_id (parsed below)
*/
if (struct_v >= 8) {
u32 v8_struct_len;
/* skip optmetadata versioned sub-structure */
ceph_decode_skip_8(p, end, bad); /* struct_v */
ceph_decode_skip_8(p, end, bad); /* struct_compat */
ceph_decode_32_safe(p, end, v8_struct_len, bad);
ceph_decode_skip_n(p, end, v8_struct_len, bad);
}
*p = end;
} else {
/* legacy (unversioned) struct */