From: Nathaniel Clark Date: Fri, 8 May 2015 15:41:26 +0000 (-0400) Subject: LU-6582 wireshark: Add new LDLM intent bits X-Git-Tag: 2.9.59~32 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=05e3d5243425c02796d83dfd8d1487e73e2c1f1f;ds=sidebyside LU-6582 wireshark: Add new LDLM intent bits Add IT_LAYOUT parsing Add IT_QUOTA_DQACQ parsing Signed-off-by: Nathaniel Clark Change-Id: I8f53fb2a5c745d3393aa0e293f616968639919e3 Reviewed-on: https://review.whamcloud.com/14732 Tested-by: Jenkins Reviewed-by: Doug Oucharek Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/contrib/wireshark/packet-lustre.c b/lustre/contrib/wireshark/packet-lustre.c index 6f30806..9405770 100644 --- a/lustre/contrib/wireshark/packet-lustre.c +++ b/lustre/contrib/wireshark/packet-lustre.c @@ -231,22 +231,46 @@ typedef enum { MDS_SWAP_LAYOUTS = 61, MDS_LAST_OPC } mds_cmd_t; +#define MDS_FIRST_OPC MDS_GETATTR + +enum { + LAYOUT_INTENT_ACCESS = 0, + LAYOUT_INTENT_READ = 1, + LAYOUT_INTENT_WRITE = 2, + LAYOUT_INTENT_GLIMPSE = 3, + LAYOUT_INTENT_TRUNC = 4, + LAYOUT_INTENT_RELEASE = 5, + LAYOUT_INTENT_RESTORE = 6 +}; + +static const value_string lustre_layout_intent_opc_values[] = { + { LAYOUT_INTENT_ACCESS, "ACCESS"}, + { LAYOUT_INTENT_READ, "READ"}, + { LAYOUT_INTENT_WRITE, "WRITE"}, + { LAYOUT_INTENT_GLIMPSE, "GLIMPSE"}, + { LAYOUT_INTENT_TRUNC, "TRUNC"}, + { LAYOUT_INTENT_RELEASE, "RELEASE"}, + { LAYOUT_INTENT_RESTORE, "RESTORE"}, + { 0, NULL }, +}; +/* From lustre/include/obd.h */ #define IT_OPEN 0x0001 #define IT_CREAT 0x0002 #define IT_READDIR 0x0004 #define IT_GETATTR 0x0008 #define IT_LOOKUP 0x0010 #define IT_UNLINK 0x0020 -#define IT_GETXATTR 0x0040 -#define IT_EXEC 0x0080 -#define IT_PIN 0x0100 - - - -#define MDS_FIRST_OPC MDS_GETATTR -#define LDLM_FIRST_OPC LDLM_ENQUEUE - +#define IT_TRUNC 0x0040 +#define IT_GETXATTR 0x0080 +#define IT_EXEC 0x0100 +#define IT_PIN 0x0200 +#define IT_LAYOUT 0x0400 +#define IT_QUOTA_DQACQ 0x0800 +#define IT_QUOTA_CONN 0x1000 +#define IT_SETXATTR 0x2000 + +/* lustre/include/lustre/lustre_idl.h */ typedef enum { REINT_SETATTR = 1, REINT_CREATE = 2, @@ -479,6 +503,9 @@ static gint ett_lustre_hsm_user_item = -1; static gint ett_lustre_hsm_extent = -1; static gint ett_lustre_hsm_progress = -1; static gint ett_lustre_hsm_user_state = -1; +static gint ett_lustre_quota_body = -1; +static gint ett_lustre_lquota_id = -1; +static gint ett_lustre_layout_intent = -1; /* -----------------------------------------------*/ /* Header field declarations */ @@ -768,6 +795,16 @@ static int hf_lustre_capa_hmac = -1; static int hf_lustre_acl = -1; +static int hf_lustre_ost_lvb_lvb_size = -1; +static int hf_lustre_ost_lvb_lvb_mtime = -1; +static int hf_lustre_ost_lvb_lvb_atime = -1; +static int hf_lustre_ost_lvb_lvb_ctime = -1; +static int hf_lustre_ost_lvb_lvb_blocks = -1; +static int hf_lustre_ost_lvb_lvb_mtime_ns = -1; +static int hf_lustre_ost_lvb_lvb_atime_ns = -1; +static int hf_lustre_ost_lvb_lvb_ctime_ns = -1; +static int hf_lustre_ost_lvb_lvb_padding = -1; + static int hf_lustre_lustre_handle_cookie = -1; static int hf_lustre_ptlrpc_body_pb_last_committed = -1; static int hf_lustre_ptlrpc_body_pb_version = -1; @@ -778,7 +815,6 @@ static int hf_lustre_ptlrpc_body_pb_pre_version = -1; static int hf_lustre_ptlrpc_body_pb_padding = -1; static int hf_lustre_ptlrpc_body_pb_jobid = -1; static int hf_lustre_lustre_msg_v1_lm_handle = -1; -static int hf_lustre_ost_lvb_lvb_atime = -1; static int hf_lustre_ptlrpc_body_pb_timeout = -1; static int hf_lustre_obd_statfs_os_bavail = -1; static int hf_lustre_obd_statfs_os_bsize = -1; @@ -793,12 +829,10 @@ static int hf_lustre_lustre_msg_v1_lm_type = -1; static int hf_lustre_niobuf_remote_len = -1; static int hf_lustre_lov_mds_md_v1_lmm_magic = -1; static int hf_lustre_ptlrpc_body_pb_op_flags = -1; -static int hf_lustre_ost_lvb_lvb_ctime = -1; static int hf_lustre_ptlrpc_body_pb_type = -1; static int hf_lustre_obd_connect_data_ocd_nllg = -1; static int hf_lustre_obd_connect_data_ocd_nllu = -1; static int hf_lustre_ll_fid_generation = -1; -static int hf_lustre_ost_lvb_lvb_mtime = -1; static int hf_lustre_obd_connect_data_ocd_ibits_known = -1; static int hf_lustre_lustre_msg_v2_lm_padding_3 = -1; static int hf_lustre_ptlrpc_body_pb_flags = -1; @@ -814,6 +848,7 @@ static int hf_lustre_lustre_msg_v2_lm_flags = -1; static int hf_lustre_obd_statfs_os_ffree = -1; static int hf_lustre_obd_statfs_os_files = -1; static int hf_lustre_lov_mds_md_v1_lmm_stripe_count = -1; +static int hf_lustre_lov_mds_md_v1_lmm_layout_gen = -1; static int hf_lustre_lustre_msg_v1_lm_flags = -1; static int hf_lustre_lustre_msg_v1_lm_last_committed = -1; static int hf_lustre_obd_statfs_os_spare9 = -1; @@ -849,7 +884,6 @@ static int hf_lustre_obd_connect_data_ocd_max_easize = -1; static int hf_lustre_obd_connect_data_ocd_instance = -1; static int hf_lustre_obd_connect_data_ocd_maxbytes = -1; static int hf_lustre_obd_connect_data_ocd_maxmodrpcs = -1; -static int hf_lustre_ost_lvb_lvb_size = -1; static int hf_lustre_obd_statfs_os_type = -1; static int hf_lustre_obd_statfs_os_spare6 = -1; static int hf_lustre_obd_statfs_os_state = -1; @@ -862,7 +896,6 @@ static int hf_lustre_ptlrpc_body_pb_last_xid = -1; static int hf_lustre_ptlrpc_body_pb_status = -1; static int hf_lustre_niobuf_remote_flags = -1; static int hf_lustre_ll_fid_id = -1; -static int hf_lustre_ost_lvb_lvb_blocks = -1; static int hf_lustre_lustre_msg_v2_lm_padding_2 = -1; static int hf_lustre_lov_ost_data_v1_l_ost_idx = -1; static int hf_lustre_obd_ioobj_ioo_seq = -1; @@ -1075,9 +1108,14 @@ static int hf_lustre_ldlm_intent_opc_readdir = -1; static int hf_lustre_ldlm_intent_opc_getattr = -1; static int hf_lustre_ldlm_intent_opc_lookup = -1; static int hf_lustre_ldlm_intent_opc_unlink = -1; +static int hf_lustre_ldlm_intent_opc_trunc = -1; static int hf_lustre_ldlm_intent_opc_getxattr = -1; static int hf_lustre_ldlm_intent_opc_exec = -1; static int hf_lustre_ldlm_intent_opc_pin = -1; +static int hf_lustre_ldlm_intent_opc_layout = -1; +static int hf_lustre_ldlm_intent_opc_q_dqacq = -1; +static int hf_lustre_ldlm_intent_opc_q_conn = -1; +static int hf_lustre_ldlm_intent_opc_setxattr = -1; static int hf_lustre_llog_hdr_llh_flag_zap_when_empty = -1; static int hf_lustre_llog_hdr_llh_flag_is_cat = -1; static int hf_lustre_llog_hdr_llh_flag_is_play = -1; @@ -1121,6 +1159,29 @@ static int hf_lustre_hsm_us_in_prog_action = -1; static int hf_lustre_hsm_us_in_prog_location = -1; static int hf_lustre_hsm_us_ext_info = -1; +/* Quota Body */ +static int hf_lustre_qb = -1; +static int hf_lustre_qb_fid = -1; +static int hf_lustre_qb_id = -1; +static int hf_lustre_qb_flags = -1; +static int hf_lustre_qb_padding = -1; +static int hf_lustre_qb_count = -1; +static int hf_lustre_qb_usage = -1; +static int hf_lustre_qb_slv_ver = -1; +static int hf_lustre_qb_lockh = -1; +static int hf_lustre_qb_glb_lockh = -1; + +static int hf_lustre_qid_fid = -1; +static int hf_lustre_qid_uid = -1; +static int hf_lustre_qid_gid = -1; + +/* Layout Intent */ +static int hf_lustre_layout_intent = -1; +static int hf_lustre_layout_intent_opc = -1; +static int hf_lustre_layout_intent_flags = -1; +static int hf_lustre_layout_intent_start = -1; +static int hf_lustre_layout_intent_end = -1; + static int hf_lustre_generic_data = -1; /* --------------------------------------------------------------------*/ @@ -1852,116 +1913,53 @@ lustre_dissect_struct_lov_ost_data_v1(tvbuff_t *tvb _U_, int offset _U_, packet_ /* IDL: uint64 lmm_object_id; */ /* IDL: uint64 lmm_object_seq; */ /* IDL: uint32 lmm_stripe_size; */ -/* IDL: uint32 lmm_stripe_count; */ +/* IDL: uint16 lmm_stripe_count; */ +/* IDL: uint16 lmm_layout_gen; */ /* IDL: struct lov_ost_data_v1 { */ /* IDL: } lmm_objects[0]; <-- en fait on en a lmm_stripe_count */ /* IDL: } */ -static int -lustre_dissect_element_lov_mds_md_v1_lmm_magic(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - offset=dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_lov_mds_md_v1_lmm_magic); - - return offset; -} - -static int -lustre_dissect_element_lov_mds_md_v1_lmm_pattern(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - offset=dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_lov_mds_md_v1_lmm_pattern); - - return offset; -} - -static int -lustre_dissect_element_lov_mds_md_v1_lmm_object_id(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - offset=dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_lov_mds_md_v1_lmm_object_id); - - return offset; -} - -static int -lustre_dissect_element_lov_mds_md_v1_lmm_object_seq(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - offset=dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_lov_mds_md_v1_lmm_object_seq); - - return offset; -} - -static int -lustre_dissect_element_lov_mds_md_v1_lmm_stripe_size(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - offset=dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_lov_mds_md_v1_lmm_stripe_size); - - return offset; -} - -static int -lustre_dissect_element_lov_mds_md_v1_lmm_stripe_count(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - offset=dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_lov_mds_md_v1_lmm_stripe_count); - - return offset; -} - -static int -lustre_dissect_element_lov_mds_md_v1_lmm_objects_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - offset=lustre_dissect_struct_lov_ost_data_v1(tvb,offset,pinfo,tree,hf_lustre_lov_mds_md_v1_lmm_objects); - return offset; -} - -static int -lustre_dissect_element_lov_mds_md_v1_lmm_objects(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int num) -{ - int i; - /*g_print("num = %d", num);*/ - for (i = 0; i < num; i++){ - offset=lustre_dissect_element_lov_mds_md_v1_lmm_objects_(tvb, offset, pinfo, tree); - } - - return offset; -} - - - int lustre_dissect_struct_lov_mds_md_v1(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, int hf_index _U_) { - proto_item *item = NULL; - proto_tree *tree = NULL; - int old_offset; - - guint32 stripe_count ; - - - old_offset=offset; - - if (parent_tree) { - item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE); - tree = proto_item_add_subtree(item, ett_lustre_lov_mds_md_v1); - } - - offset=lustre_dissect_element_lov_mds_md_v1_lmm_magic(tvb, offset, pinfo, tree); - - offset=lustre_dissect_element_lov_mds_md_v1_lmm_pattern(tvb, offset, pinfo, tree); + proto_item *item = NULL; + proto_tree *tree = NULL; + int old_offset, i; - offset=lustre_dissect_element_lov_mds_md_v1_lmm_object_id(tvb, offset, pinfo, tree); + guint16 stripe_count; - offset=lustre_dissect_element_lov_mds_md_v1_lmm_object_seq(tvb, offset, pinfo, tree); + old_offset=offset; - offset=lustre_dissect_element_lov_mds_md_v1_lmm_stripe_size(tvb, offset, pinfo, tree); + if (parent_tree) { + item = proto_tree_add_item(parent_tree, hf_index, + tvb, offset, -1, TRUE); + tree = proto_item_add_subtree(item, ett_lustre_lov_mds_md_v1); + } - stripe_count = tvb_get_letohl(tvb,offset); - offset=lustre_dissect_element_lov_mds_md_v1_lmm_stripe_count(tvb, offset, pinfo, tree); + offset = dissect_uint32(tvb, offset, pinfo, tree, + hf_lustre_lov_mds_md_v1_lmm_magic); + offset = dissect_uint32(tvb, offset, pinfo, tree, + hf_lustre_lov_mds_md_v1_lmm_pattern); + offset = dissect_uint64(tvb, offset, pinfo, tree, + hf_lustre_lov_mds_md_v1_lmm_object_id); + offset = dissect_uint64(tvb, offset, pinfo, tree, + hf_lustre_lov_mds_md_v1_lmm_object_seq); + offset = dissect_uint32(tvb, offset, pinfo, tree, + hf_lustre_lov_mds_md_v1_lmm_stripe_size); - offset=lustre_dissect_element_lov_mds_md_v1_lmm_objects(tvb, offset, pinfo, tree, stripe_count); + stripe_count = tvb_get_letohs(tvb, offset); + offset = dissect_uint16(tvb, offset, pinfo, tree, + hf_lustre_lov_mds_md_v1_lmm_stripe_count); + offset = dissect_uint16(tvb, offset, pinfo, tree, + hf_lustre_lov_mds_md_v1_lmm_layout_gen); + for (i = 0; i < stripe_count; ++i) + offset = lustre_dissect_struct_lov_ost_data_v1(tvb, offset, + pinfo, tree, hf_lustre_lov_mds_md_v1_lmm_objects); - proto_item_set_len(item, offset-old_offset); + proto_item_set_len(item, offset-old_offset); - return offset; + return offset; } int @@ -1982,7 +1980,7 @@ lustre_dissect_struct_lov_mds_md(tvbuff_t *tvb _U_, int offset _U_, packet_info break; default: offset=lustre_dissect_element_data(tvb, offset, pinfo, parent_tree, - hf_lustre_extra_padding, buff_num); + hf_lustre_generic_data, buff_num); break; }; @@ -2381,92 +2379,88 @@ lustre_dissect_struct_niobuf_remote(tvbuff_t *tvb _U_, int offset _U_, packet_in /* IDL: uint64 lvb_atime; */ /* IDL: uint64 lvb_ctime; */ /* IDL: uint64 lvb_blocks; */ +/* v1 of this type ends here */ +/* uint32 lvb_mtime_ns; */ +/* uint32 lvb_atime_ns; */ +/* uint32 lvb_ctime_ns; */ +/* uint32 lvb_padding; */ /* IDL: } */ static int -lustre_dissect_element_ost_lvb_lvb_size(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - offset=dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_ost_lvb_lvb_size); - - return offset; -} - -static int -lustre_dissect_element_ost_lvb_lvb_mtime(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - nstime_t ns; - /* timestamp */ - ns.secs = tvb_get_letohl(tvb,offset); - ns.nsecs=0; - proto_tree_add_time(tree, hf_lustre_ost_lvb_lvb_mtime, tvb, offset, 8, &ns ); - offset+=8; - return offset; -} - -static int -lustre_dissect_element_ost_lvb_lvb_atime(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) +lustre_dissect_element_ost_lvb_lvb_time(tvbuff_t *tvb _U_, int offset _U_, + packet_info *pinfo _U_, + proto_tree *tree _U_, + int hf_index _U_, int ns_offset _U_) { - nstime_t ns; - /* timestamp */ - ns.secs = tvb_get_letohl(tvb,offset); - ns.nsecs=0; - proto_tree_add_time(tree, hf_lustre_ost_lvb_lvb_atime, tvb, offset, 8, &ns ); - offset+=8; - - return offset; -} - -static int -lustre_dissect_element_ost_lvb_lvb_ctime(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - nstime_t ns; - /* timestamp */ - ns.secs = tvb_get_letohl(tvb,offset); - ns.nsecs=0; - proto_tree_add_time(tree, hf_lustre_ost_lvb_lvb_ctime, tvb, offset, 8, &ns ); - offset+=8; - - return offset; -} - -static int -lustre_dissect_element_ost_lvb_lvb_blocks(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - offset=dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_ost_lvb_lvb_blocks); - - return offset; + nstime_t ns; + /* timestamp */ + ns.secs = tvb_get_letoh64(tvb, offset); + if (ns_offset != 0) + ns.nsecs = tvb_get_letohl(tvb, offset+ns_offset); + proto_tree_add_time(tree, hf_index, tvb, offset, 8, &ns); + offset += 8; + return offset; } int -lustre_dissect_struct_ost_lvb(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, int hf_index _U_) +lustre_dissect_struct_ost_lvb(tvbuff_t *tvb _U_, int offset _U_, + packet_info *pinfo _U_, + proto_tree *parent_tree _U_, + int hf_index _U_, int buff_num _U_) { - proto_item *item = NULL; - proto_tree *tree = NULL; - int old_offset; + proto_item *item = NULL; + proto_tree *tree = NULL; + int old_offset; + int buff_len; + buff_len = LUSTRE_BUFFER_LEN(buff_num); + if (buff_len == 0) + return offset; - old_offset=offset; + old_offset=offset; - if (parent_tree) { - item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE); - tree = proto_item_add_subtree(item, ett_lustre_ost_lvb); - } - - offset=lustre_dissect_element_ost_lvb_lvb_size(tvb, offset, pinfo, tree); + if (parent_tree) { + item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE); + tree = proto_item_add_subtree(item, ett_lustre_ost_lvb); + } - offset=lustre_dissect_element_ost_lvb_lvb_mtime(tvb, offset, pinfo, tree); + /* v1 format size is 40 + * v2 format size is 56 w/ ns for times + */ - offset=lustre_dissect_element_ost_lvb_lvb_atime(tvb, offset, pinfo, tree); + offset = dissect_uint64(tvb, offset, pinfo, tree, + hf_lustre_ost_lvb_lvb_size); - offset=lustre_dissect_element_ost_lvb_lvb_ctime(tvb, offset, pinfo, tree); + offset = lustre_dissect_element_ost_lvb_lvb_time(tvb, offset, + pinfo, tree, hf_lustre_ost_lvb_lvb_mtime, + (buff_len >= 56) ?32 :0); - offset=lustre_dissect_element_ost_lvb_lvb_blocks(tvb, offset, pinfo, tree); + offset = lustre_dissect_element_ost_lvb_lvb_time(tvb, offset, + pinfo, tree, hf_lustre_ost_lvb_lvb_atime, + (buff_len >= 56) ?28 :0); + offset = lustre_dissect_element_ost_lvb_lvb_time(tvb, offset, + pinfo, tree, hf_lustre_ost_lvb_lvb_ctime, + (buff_len >= 56) ?24 :0); - proto_item_set_len(item, offset-old_offset); + offset = dissect_uint64(tvb, offset, pinfo, tree, + hf_lustre_ost_lvb_lvb_blocks); + + /* post-v1 format */ + if (buff_len >= 56) { + offset = dissect_uint32(tvb, offset, pinfo, tree, + hf_lustre_ost_lvb_lvb_mtime_ns); + offset = dissect_uint32(tvb, offset, pinfo, tree, + hf_lustre_ost_lvb_lvb_atime_ns); + offset = dissect_uint32(tvb, offset, pinfo, tree, + hf_lustre_ost_lvb_lvb_ctime_ns); + offset = dissect_uint32(tvb, offset, pinfo, tree, + hf_lustre_ost_lvb_lvb_padding); + } + proto_item_set_len(item, offset-old_offset); - return offset; + return offset; } @@ -5518,20 +5512,28 @@ lustre_dissect_struct_ldlm_flock(tvbuff_t *tvb _U_, int offset _U_, packet_info /* IDL: } */ static int -lustre_dissect_element_ldlm_intent_opc(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_) -{ - guint32 opcode; - /* this opcode is like a flag*/ - dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_intent_opc_open ); - dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_intent_opc_creat ); - dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_intent_opc_readdir ); - dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_intent_opc_getattr ); - dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_intent_opc_lookup ); - dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_intent_opc_unlink ); - dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_intent_opc_getxattr); - dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_intent_opc_exec ); - dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_ldlm_intent_opc_pin ); - opcode = tvb_get_letohl(tvb,offset); +lustre_dissect_element_ldlm_intent_opc(tvbuff_t *tvb _U_, int offset _U_, + packet_info *pinfo _U_, + proto_tree *tree _U_) +{ + guint32 opcode; + /* this opcode is like a flag*/ +#define DOBIT(_hf) dissect_uint32(tvb, offset, pinfo, tree, (_hf)) + DOBIT(hf_lustre_ldlm_intent_opc_open ); + DOBIT(hf_lustre_ldlm_intent_opc_creat ); + DOBIT(hf_lustre_ldlm_intent_opc_readdir ); + DOBIT(hf_lustre_ldlm_intent_opc_getattr ); + DOBIT(hf_lustre_ldlm_intent_opc_lookup ); + DOBIT(hf_lustre_ldlm_intent_opc_unlink ); + DOBIT(hf_lustre_ldlm_intent_opc_getxattr); + DOBIT(hf_lustre_ldlm_intent_opc_exec ); + DOBIT(hf_lustre_ldlm_intent_opc_pin ); + DOBIT(hf_lustre_ldlm_intent_opc_layout ); + DOBIT(hf_lustre_ldlm_intent_opc_q_dqacq ); + DOBIT(hf_lustre_ldlm_intent_opc_q_conn ); + DOBIT(hf_lustre_ldlm_intent_opc_setxattr); +#undef DOBIT + opcode = tvb_get_letohl(tvb,offset); display_info_str(tree->parent, pinfo->cinfo, COL_INFO, "[ intent :"); if(opcode & IT_OPEN ){ @@ -5558,6 +5560,10 @@ lustre_dissect_element_ldlm_intent_opc(tvbuff_t *tvb _U_, int offset _U_, packet display_info_str(tree->parent, pinfo->cinfo, COL_INFO, " unlink"); proto_item_append_text(tree, " unlink" ); } + if(opcode & IT_TRUNC ){ + display_info_str(tree->parent, pinfo->cinfo, COL_INFO, " trunc"); + proto_item_append_text(tree, " trunc" ); + } if(opcode & IT_GETXATTR){ display_info_str(tree->parent, pinfo->cinfo, COL_INFO, " getxattr"); proto_item_append_text(tree, " getxattr" ); @@ -5570,6 +5576,22 @@ lustre_dissect_element_ldlm_intent_opc(tvbuff_t *tvb _U_, int offset _U_, packet display_info_str(tree->parent, pinfo->cinfo, COL_INFO, " pin"); proto_item_append_text(tree, " pin" ); } + if(opcode & IT_LAYOUT ){ + display_info_str(tree->parent, pinfo->cinfo, COL_INFO, " layout"); + proto_item_append_text(tree, " layout" ); + } + if(opcode & IT_QUOTA_DQACQ ){ + display_info_str(tree->parent, pinfo->cinfo, COL_INFO, " quota_dqacq"); + proto_item_append_text(tree, " quota_dqacq" ); + } + if(opcode & IT_QUOTA_CONN ){ + display_info_str(tree->parent, pinfo->cinfo, COL_INFO, " quota_conn"); + proto_item_append_text(tree, " quota_conn" ); + } + if(opcode & IT_SETXATTR ){ + display_info_str(tree->parent, pinfo->cinfo, COL_INFO, " setxattr"); + proto_item_append_text(tree, " setxattr" ); + } display_info_str(tree->parent, pinfo->cinfo, COL_INFO, " ]"); offset+=8; @@ -8362,6 +8384,102 @@ lustre_dissect_struct_capa(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo return offset; } +int +lustre_dissect_struct_lquota_id(tvbuff_t *tvb _U_, int offset _U_, + packet_info *pinfo _U_, + proto_tree *parent_tree _U_, + int hf_index _U_) +{ + proto_item *item = NULL; + proto_tree *tree = NULL; + int old_offset; + + old_offset=offset; + + if (parent_tree) { + item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE); + tree = proto_item_add_subtree(item, ett_lustre_lquota_id); + } + + offset=lustre_dissect_struct_lu_fid(tvb,offset,pinfo,tree,hf_lustre_qid_fid); + offset=dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_qid_uid); + offset=dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_qid_gid); + + if (item) + proto_item_set_len(item, offset-old_offset); + return offset; +} + +int +lustre_dissect_struct_quota_body(tvbuff_t *tvb _U_, int offset _U_, + packet_info *pinfo _U_, + proto_tree *parent_tree _U_, + int hf_index _U_, guint32 buf_num) +{ + proto_item *item = NULL; + proto_tree *tree = NULL; + int old_offset; + int data_len; + + old_offset=offset; + + data_len = LUSTRE_BUFFER_LEN(buf_num); + if (data_len == 0) + return offset; + + if (parent_tree) { + item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE); + tree = proto_item_add_subtree(item, ett_lustre_quota_body); + } + + offset = lustre_dissect_struct_lu_fid(tvb, offset, pinfo, tree, hf_lustre_qb_fid); + offset = lustre_dissect_struct_lquota_id(tvb, offset, pinfo, tree, hf_lustre_qb_id); + offset = dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_qb_flags); + offset = dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_qb_padding); + offset = dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_qb_count); + offset = dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_qb_usage); + offset = dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_qb_slv_ver); + offset = lustre_dissect_struct_handle_cookie(tvb, offset, pinfo, tree, + hf_lustre_qb_lockh); + offset = lustre_dissect_struct_handle_cookie(tvb, offset, pinfo, tree, + hf_lustre_qb_glb_lockh); + offset = lustre_dissect_struct_element_data(tvb, offset, pinfo, tree, + hf_lustre_qb_padding, 32); + if (item) + proto_item_set_len(item, offset-old_offset); + return offset; +} + +int +lustre_dissect_struct_layout_intent(tvbuff_t *tvb _U_, int offset _U_, + packet_info *pinfo _U_, + proto_tree *parent_tree _U_, + int hf_index _U_, guint32 buf_num) +{ + proto_item *item = NULL; + proto_tree *tree = NULL; + int old_offset; + int data_len; + + old_offset=offset; + + data_len = LUSTRE_BUFFER_LEN(buf_num); + if (data_len == 0) + return offset; + + if (parent_tree) { + item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE); + tree = proto_item_add_subtree(item, ett_lustre_layout_intent); + } + + offset = dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_layout_intent_opc); + offset = dissect_uint32(tvb, offset, pinfo, tree, hf_lustre_layout_intent_flags); + offset = dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_layout_intent_start); + offset = dissect_uint64(tvb, offset, pinfo, tree, hf_lustre_layout_intent_end); + if (item) + proto_item_set_len(item, offset-old_offset); + return offset; +} int lustre_dissect_struct_acl(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, int hf_index _U_, guint32 buf_num) @@ -8843,9 +8961,6 @@ static int reint_opcode_process(tvbuff_t *tvb _U_, int offset _U_, packet_info * offset=lustre_dissect_struct_ldlm_request(tvb, offset, pinfo, tree, hf_lustre_ldlm_request); break; - default: - break; - } return offset ; @@ -9232,18 +9347,25 @@ lustre_ldlm_opcode_process(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo if (LUSTRE_BUFCOUNT <= 2) break; - if (LUSTRE_BUFFER_LEN(LUSTRE_REPLY_REC_OFF) == 40) + if (LUSTRE_BUFFER_LEN(LUSTRE_DLM_REPLY_REC_OFF) == 40) { /* TODO :this code need to be check and test, the * lustre corresponding code isn't explicit, so not * sure to have this buffer, but in example it works * fine */ offset=lustre_dissect_struct_ost_lvb(tvb, offset, pinfo, tree, - hf_lustre_ost_lvb); - - else if (ldlm_type == LDLM_EXTENT) { - offset=lustre_dissect_struct_lov_mds_md(tvb,offset,pinfo,tree,hf_lustre_lov_mds_md_v1, - LUSTRE_DLM_REPLY_REC_OFF); + hf_lustre_ost_lvb, + LUSTRE_DLM_REPLY_REC_OFF); + } else if ((ldlm_type == LDLM_EXTENT) || (LUSTRE_BUFCOUNT == 3)) { + int magic; + magic=tvb_get_letohl(tvb, offset); + if (magic == LOV_MAGIC_V1) + offset = lustre_dissect_struct_lov_mds_md_v1(tvb, offset, + pinfo, tree, hf_lustre_lov_mds_md_v1); + else + offset = lustre_dissect_struct_ost_lvb(tvb, offset, pinfo, + tree, hf_lustre_ost_lvb, + LUSTRE_DLM_REPLY_REC_OFF); break; } @@ -9287,8 +9409,9 @@ lustre_ldlm_opcode_process(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo /*[ldlm_request] if the third buffer exist we have [lvb data] so it's [ost_lvb] : TODO : * check that */ offset=lustre_dissect_struct_ldlm_request(tvb, offset, pinfo, tree, hf_lustre_ldlm_request) ; - if(LUSTRE_BUFFER_LEN(LUSTRE_DLM_REPLY_REC_OFF) > 0) - offset=lustre_dissect_struct_ost_lvb(tvb,offset,pinfo,tree,hf_lustre_ost_lvb); + offset = lustre_dissect_struct_ost_lvb(tvb, offset, pinfo, tree, + hf_lustre_ost_lvb, + LUSTRE_DLM_REPLY_REC_OFF); } /*reply : [nothing] */ break; @@ -9296,11 +9419,14 @@ lustre_ldlm_opcode_process(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo case LDLM_GL_CALLBACK: if(pb_type==PTL_RPC_MSG_REQUEST) { /*[ldlm_request] [lvb (for gl_desc)]*/ offset=lustre_dissect_struct_ldlm_request(tvb, offset, pinfo, tree, hf_lustre_ldlm_request) ; - if(LUSTRE_BUFFER_LEN(LUSTRE_DLM_REPLY_REC_OFF) > 0) - offset=lustre_dissect_struct_ost_lvb(tvb,offset,pinfo,tree,hf_lustre_ost_lvb); + offset = lustre_dissect_struct_ost_lvb(tvb, offset, pinfo, tree, + hf_lustre_ost_lvb, + LUSTRE_REQ_REC_OFF+1); } if(pb_type==PTL_RPC_MSG_REPLY) /* [ost_lvb] */ - offset=lustre_dissect_struct_ost_lvb(tvb, offset, pinfo, tree, hf_lustre_ost_lvb); + offset=lustre_dissect_struct_ost_lvb(tvb, offset, pinfo, tree, + hf_lustre_ost_lvb, + LUSTRE_REPLY_REC_OFF); break; case LDLM_SET_INFO: @@ -9610,6 +9736,20 @@ ldlm_opcode_process(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, offset=lustre_dissect_element_filename(tvb, offset, pinfo, tree, hf_lustre_reint_name, LUSTRE_DLM_INTENT_REC_OFF+2); } + if (intent_opc & IT_LAYOUT) { + /* [layout_intent][eadata] */ + offset = lustre_dissect_struct_layout_intent(tvb, offset, + pinfo, tree, hf_lustre_layout_intent, + LUSTRE_DLM_INTENT_REC_OFF); + offset=lustre_dissect_element_data(tvb, offset, pinfo, tree, + hf_lustre_mds_xattr_eadata, + LUSTRE_DLM_INTENT_REC_OFF+1); + } + if (intent_opc & IT_QUOTA_DQACQ) { + offset = lustre_dissect_struct_quota_body(tvb, offset, + pinfo, tree, hf_lustre_qb, + LUSTRE_DLM_INTENT_REC_OFF); + } return offset; } @@ -10767,6 +10907,14 @@ void proto_register_dcerpc_lustre(void) { &hf_lustre_ost_lvb_lvb_mtime, { "Lvb Mtime", "lustre.ost_lvb.lvb_mtime",FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, "", HFILL } }, + { &hf_lustre_ost_lvb_lvb_mtime_ns, + { "Lvb Mtime NS", "lustre.ost_lvb.lvb_mtime_ns", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }}, + { &hf_lustre_ost_lvb_lvb_atime_ns, + { "Lvb Atime NS", "lustre.ost_lvb.lvb_atime_ns", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }}, + { &hf_lustre_ost_lvb_lvb_ctime_ns, + { "Lvb Ctime NS", "lustre.ost_lvb.lvb_ctime_ns", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }}, + { &hf_lustre_ost_lvb_lvb_padding, + { "padding", "lustre.ost_lvb.padding", FT_UINT32, BASE_HEX, NULL, 0, "", HFILL }}, { &hf_lustre_obd_connect_data_ocd_ibits_known, { "Ocd Ibits Known", "lustre.obd_connect_data.ocd_ibits_known", FT_UINT64, BASE_DEC, NULL, 0, "", HFILL }}, { &hf_lustre_lustre_msg_v2_lm_padding_3, @@ -10796,7 +10944,9 @@ void proto_register_dcerpc_lustre(void) { &hf_lustre_obd_statfs_os_files, { "Os Files", "lustre.obd_statfs.os_files", FT_UINT64, BASE_DEC, NULL, 0, "", HFILL }}, { &hf_lustre_lov_mds_md_v1_lmm_stripe_count, - { "Lmm Stripe Count", "lustre.lov_mds_md_v1.lmm_stripe_count", FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }}, + { "Lmm Stripe Count", "lustre.lov_mds_md_v1.lmm_stripe_count", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }}, + { &hf_lustre_lov_mds_md_v1_lmm_layout_gen, + { "Lmm Layout Generation", "lustre.lov_mds_md_v1.lmm_layout_gen", FT_UINT16, BASE_DEC, NULL, 0, "", HFILL }}, { &hf_lustre_lustre_msg_v1_lm_flags, { "Lm Flags", "lustre.lustre_msg_v1.lm_flags", FT_UINT32, BASE_HEX, NULL, 0, "", HFILL }}, { &hf_lustre_lustre_msg_v1_lm_last_committed, @@ -11075,12 +11225,22 @@ void proto_register_dcerpc_lustre(void) { "lookup", "lustre.ldlm_intent.opc_lookup", FT_BOOLEAN, 32, TFS(&lnet_flags_set_truth), IT_LOOKUP , "", HFILL } }, { &hf_lustre_ldlm_intent_opc_unlink, { "unlink", "lustre.ldlm_intent.opc_unlink", FT_BOOLEAN, 32, TFS(&lnet_flags_set_truth), IT_UNLINK , "", HFILL } }, + { &hf_lustre_ldlm_intent_opc_trunc, + { "trunc", "lustre.ldlm_intent.opc_trunc", FT_BOOLEAN, 32, TFS(&lnet_flags_set_truth), IT_TRUNC , "", HFILL } }, { &hf_lustre_ldlm_intent_opc_getxattr, { "getxattr", "lustre.ldlm_intent.opc_getxattr", FT_BOOLEAN, 32, TFS(&lnet_flags_set_truth), IT_GETXATTR , "", HFILL } }, { &hf_lustre_ldlm_intent_opc_exec, { "exec", "lustre.ldlm_intent.opc_exec", FT_BOOLEAN, 32, TFS(&lnet_flags_set_truth), IT_EXEC , "", HFILL } }, { &hf_lustre_ldlm_intent_opc_pin, { "pin", "lustre.ldlm_intent.opc_pin", FT_BOOLEAN, 32, TFS(&lnet_flags_set_truth), IT_PIN , "", HFILL } }, + { &hf_lustre_ldlm_intent_opc_layout, + { "layout", "lustre.ldlm_intent.opc_layout", FT_BOOLEAN, 32, TFS(&lnet_flags_set_truth), IT_LAYOUT , "", HFILL } }, + { &hf_lustre_ldlm_intent_opc_q_dqacq, + { "quota dqacq", "lustre.ldlm_intent.opc_quota_dqacq", FT_BOOLEAN, 32, TFS(&lnet_flags_set_truth), IT_QUOTA_DQACQ , "", HFILL } }, + { &hf_lustre_ldlm_intent_opc_q_conn, + { "quota conn", "lustre.ldlm_intent.opc_quota_conn", FT_BOOLEAN, 32, TFS(&lnet_flags_set_truth), IT_QUOTA_CONN , "", HFILL } }, + { &hf_lustre_ldlm_intent_opc_setxattr, + { "setxattr", "lustre.ldlm_intent.opc_setxattr", FT_BOOLEAN, 32, TFS(&lnet_flags_set_truth), IT_SETXATTR , "", HFILL } }, /*-------------------------------------------------------------------*/ { &hf_lustre_ldlm_intent_opc, { "intent opcode", "lustre.ldlm_intent.opc", FT_NONE, BASE_NONE, NULL, 0, "", HFILL}}, @@ -11641,6 +11801,45 @@ void proto_register_dcerpc_lustre(void) { &hf_lustre_hsm_us_ext_info, { "Extended Info", "lustre.hsm_state_get.ext_info", FT_NONE, BASE_NONE, NULL, 0, "", HFILL } }, + { &hf_lustre_qb, + { "Quota Body", "lustre.quota_body", FT_NONE, BASE_NONE, NULL, 0, "", HFILL } }, + { &hf_lustre_qb_fid, + { "Fid", "lustre.quota_body.fid", FT_NONE, BASE_NONE, NULL, 0, "", HFILL } }, + { &hf_lustre_qb_id, + { "ID", "lustre.quota_body.id", FT_NONE, BASE_NONE, NULL, 0, "", HFILL } }, + { &hf_lustre_qb_flags, + { "Flags", "lustre.quota_body.flags", FT_UINT32, BASE_HEX, NULL, 0, "", HFILL } }, + { &hf_lustre_qb_padding, + { "padding", "lustre.quota_body.padding", FT_NONE, BASE_NONE, NULL, 0, "", HFILL } }, + { &hf_lustre_qb_count, + { "Count", "lustre.quota_body.count", FT_UINT64, BASE_DEC, NULL, 0, "", HFILL } }, + { &hf_lustre_qb_usage, + { "Usage", "lustre.quota_body.usage", FT_UINT64, BASE_DEC, NULL, 0, "", HFILL } }, + { &hf_lustre_qb_slv_ver, + { "Slave Ver", "lustre.quota_body.slv_ver", FT_UINT64, BASE_DEC, NULL, 0, "", HFILL } }, + { &hf_lustre_qb_lockh, + { "Per-ID Lock Handle", "lustre.quota_body.lockh", FT_NONE, BASE_NONE, NULL, 0, "", HFILL } }, + { &hf_lustre_qb_glb_lockh, + { "Global Lock Handle", "lustre.quota_body.glb_lockh", FT_NONE, BASE_NONE, NULL, 0, "", HFILL } }, + + { &hf_lustre_qid_fid, + { "Fid", "lustre.lquota_id.fid", FT_NONE, BASE_NONE, NULL, 0, "", HFILL } }, + { &hf_lustre_qid_uid, + { "UID", "lustre.lquota_id.uid", FT_UINT64, BASE_DEC, NULL, 0, "", HFILL } }, + { &hf_lustre_qid_gid, + { "GID", "lustre.lquota_id.gid", FT_UINT64, BASE_DEC, NULL, 0, "", HFILL } }, + + { &hf_lustre_layout_intent, + { "Layout Intent", "lustre.layout_intent", FT_NONE, BASE_NONE, NULL, 0, "", HFILL } }, + { &hf_lustre_layout_intent_opc, + { "Op Code", "lustre.layout_intent.opc", FT_UINT32, BASE_HEX, VALS(lustre_layout_intent_opc_values), 0, "", HFILL } }, + { &hf_lustre_layout_intent_flags, + { "Flags", "lustre.layout_intent.flags", FT_UINT32, BASE_HEX, NULL, 0, "", HFILL } }, + { &hf_lustre_layout_intent_start, + { "Start", "lustre.layout_intent.start", FT_UINT64, BASE_DEC, NULL, 0, "", HFILL } }, + { &hf_lustre_layout_intent_end, + { "End", "lustre.layout_intent.end", FT_UINT64, BASE_DEC, NULL, 0, "", HFILL } }, + { &hf_lustre_generic_data, { "generic data", "lustre.generic_data", FT_NONE, BASE_NONE, NULL, 0, "", HFILL}}, }; @@ -11724,6 +11923,9 @@ void proto_register_dcerpc_lustre(void) &ett_lustre_hsm_extent, &ett_lustre_hsm_progress, &ett_lustre_hsm_user_state, + &ett_lustre_quota_body, + &ett_lustre_lquota_id, + &ett_lustre_layout_intent, }; proto_lustre = proto_register_protocol("Lustre", "lustre", "lustre");