Commit e58103ca authored by Alex Markuze's avatar Alex Markuze Committed by Ilya Dryomov
Browse files

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: default avatarAlex Markuze <amarkuze@redhat.com>
Reviewed-by: default avatarViacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 1c439de7
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -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 */