Skip to content

Commit e58103c

Browse files
Alex Markuzeidryomov
authored andcommitted
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>
1 parent 1c439de commit e58103c

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

fs/ceph/mds_client.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,26 @@ static int parse_reply_info_in(void **p, void *end,
232232
info->fscrypt_file_len, bad);
233233
}
234234
}
235+
236+
/*
237+
* InodeStat encoding versions:
238+
* v1-v7: various fields added over time
239+
* v8: added optmetadata (versioned sub-structure containing
240+
* optional inode metadata like charmap for case-insensitive
241+
* filesystems). The kernel client doesn't support
242+
* case-insensitive lookups, so we skip this field.
243+
* v9: added subvolume_id (parsed below)
244+
*/
245+
if (struct_v >= 8) {
246+
u32 v8_struct_len;
247+
248+
/* skip optmetadata versioned sub-structure */
249+
ceph_decode_skip_8(p, end, bad); /* struct_v */
250+
ceph_decode_skip_8(p, end, bad); /* struct_compat */
251+
ceph_decode_32_safe(p, end, v8_struct_len, bad);
252+
ceph_decode_skip_n(p, end, v8_struct_len, bad);
253+
}
254+
235255
*p = end;
236256
} else {
237257
/* legacy (unversioned) struct */

0 commit comments

Comments
 (0)