Whamcloud - gitweb
LU-11997 ptlrpc: Properly swab ll_fiemap_info_key 81/36481/5
authorOleg Drokin <green@whamcloud.com>
Fri, 27 Sep 2019 14:23:18 +0000 (10:23 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 12 Dec 2019 23:06:33 +0000 (23:06 +0000)
It was using lustre_swab_fiemap which is incorrect since the
structures don't match.

Added lustre_swab_fiemap_info_key that swabs embedded
obdo and ll_fiemap_info_key structures.

Lustre-change: https://review.whamcloud.com/36308
Lustre-commit: 2b905746ee3b5d9dbafcdb1af5930aea18120a7b

Change-Id: Ie701163bd4c2072a0461b2d9485bc184c6548f8f
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/36481
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/include/lustre_swab.h
lustre/ptlrpc/layout.c
lustre/ptlrpc/pack_generic.c

index 911c795..96dcd49 100644 (file)
@@ -93,6 +93,7 @@ void lustre_swab_obdo(struct obdo *o);
 void lustre_swab_ost_body(struct ost_body *b);
 void lustre_swab_ost_last_id(__u64 *id);
 void lustre_swab_fiemap(struct fiemap *fiemap);
+void lustre_swab_fiemap_info_key(struct ll_fiemap_info_key *fiemap_info);
 void lustre_swab_lov_user_md_v1(struct lov_user_md_v1 *lum);
 void lustre_swab_lov_user_md_v3(struct lov_user_md_v3 *lum);
 void lustre_swab_lov_comp_md_v1(struct lov_comp_md_v1 *lum);
index a756ab8..19ff646 100644 (file)
@@ -1189,8 +1189,8 @@ struct req_msg_field RMF_OST_ID =
 EXPORT_SYMBOL(RMF_OST_ID);
 
 struct req_msg_field RMF_FIEMAP_KEY =
-        DEFINE_MSGF("fiemap", 0, sizeof(struct ll_fiemap_info_key),
-                    lustre_swab_fiemap, NULL);
+       DEFINE_MSGF("fiemap_key", 0, sizeof(struct ll_fiemap_info_key),
+                   lustre_swab_fiemap_info_key, NULL);
 EXPORT_SYMBOL(RMF_FIEMAP_KEY);
 
 struct req_msg_field RMF_FIEMAP_VAL =
index ec93e42..79ddfae 100644 (file)
@@ -2026,21 +2026,32 @@ static void lustre_swab_fiemap_extent(struct fiemap_extent *fm_extent)
         __swab32s(&fm_extent->fe_device);
 }
 
+static void lustre_swab_fiemap_hdr(struct fiemap *fiemap)
+{
+       __swab64s(&fiemap->fm_start);
+       __swab64s(&fiemap->fm_length);
+       __swab32s(&fiemap->fm_flags);
+       __swab32s(&fiemap->fm_mapped_extents);
+       __swab32s(&fiemap->fm_extent_count);
+       __swab32s(&fiemap->fm_reserved);
+}
+
 void lustre_swab_fiemap(struct fiemap *fiemap)
 {
        __u32 i;
 
-        __swab64s(&fiemap->fm_start);
-        __swab64s(&fiemap->fm_length);
-        __swab32s(&fiemap->fm_flags);
-        __swab32s(&fiemap->fm_mapped_extents);
-        __swab32s(&fiemap->fm_extent_count);
-        __swab32s(&fiemap->fm_reserved);
+       lustre_swab_fiemap_hdr(fiemap);
 
         for (i = 0; i < fiemap->fm_mapped_extents; i++)
                 lustre_swab_fiemap_extent(&fiemap->fm_extents[i]);
 }
 
+void lustre_swab_fiemap_info_key(struct ll_fiemap_info_key *fiemap_info)
+{
+       lustre_swab_obdo(&fiemap_info->lfik_oa);
+       lustre_swab_fiemap_hdr(&fiemap_info->lfik_fiemap);
+}
+
 void lustre_swab_idx_info(struct idx_info *ii)
 {
        __swab32s(&ii->ii_magic);