]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ceph: handle InodeStat v8 versioned field in reply parsing
authorAlex Markuze <amarkuze@redhat.com>
Tue, 10 Feb 2026 09:06:24 +0000 (09:06 +0000)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 21 Apr 2026 23:40:23 +0000 (01:40 +0200)
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>
fs/ceph/mds_client.c

index 4fa471d9b3b223e4cf608d9aec4cc3af9f8f08f9..3b534e6522e76f074dc758322f78827e137d24a8 100644 (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 */