Whamcloud - gitweb
LU-13602 pcc: add LCM_FL_PCC_RDONLY layout flag 13/40813/4
authorQian Yingjin <qian@ddn.com>
Tue, 1 Dec 2020 08:22:08 +0000 (16:22 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 28 Jul 2021 02:31:51 +0000 (02:31 +0000)
The upcoming new feature PCC-RO is combined with FLR and extend
the on-disk data strucutre 'enum lov_comp_md_flags' for layout
components. It adds a new layout flag: LCM_FL_PCC_RDONLY.

enum lov_comp_md_flags {
LCM_FL_NONE = 0x0,
LCM_FL_RDONLY = 0x1,
LCM_FL_WRITE_PENDING = 0x2,
LCM_FL_SYNC_PENDING = 0x3,
LCM_FL_PCC_RDONLY = 0x8,
LCM_FL_FLR_MASK         = 0xB,
};

The LCM_FL_PCC_RDONLY flag, which is dedicated for PCC-RO, is
different from LCM_FL_RDONLY.
A PCC-RO cached file could be in the state:
- LCM_FL_PCC_RDONLY | LCM_FL_RDONLY: it means that all FLR
  components are synced and in up-to-date state. The replicated
  file is on read-only state. And then one client attaches the
  file into the PCC backend with PCC-RO mode.
- LCM_FL_PCC_RDONLY | LCM_FL_WRITE_PENDING: it means the file was
  once modified, the data content of layout components are not
  synced. MDT has already picked a promary replica and marked
  other components as STALE. At this time, a client can still
  PCC-RO attach the file. On this client, the primary component
  and the PCC copy are both in up-to-date state.

As a new LCM_FL_PCC_RDONLY flag is added, the old client may not
understand this new FLR layout flag, and may result in
inconsistent data access.

This patch adds this new flag for the purpose of compatibility and
interoperability.

Test-Parameters: trivial
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: I2e96f413c0b35355503c20dfea0a39d39a216d90
Reviewed-on: https://review.whamcloud.com/40813
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/lod/lod_internal.h
lustre/ptlrpc/wiretest.c
lustre/utils/wiretest.c

index 7fa3564..a245691 100644 (file)
@@ -932,12 +932,13 @@ static inline __u16 mirror_id_of(__u32 id)
  * on-disk data for lcm_flags. Valid if lcm_magic is LOV_MAGIC_COMP_V1.
  */
 enum lov_comp_md_flags {
  * on-disk data for lcm_flags. Valid if lcm_magic is LOV_MAGIC_COMP_V1.
  */
 enum lov_comp_md_flags {
-       /* the least 2 bits are used by FLR to record file state */
-       LCM_FL_NONE          = 0,
-       LCM_FL_RDONLY           = 1,
-       LCM_FL_WRITE_PENDING    = 2,
-       LCM_FL_SYNC_PENDING     = 3,
-       LCM_FL_FLR_MASK         = 0x3,
+       /* the least 4 bits are used by FLR to record file state */
+       LCM_FL_NONE             = 0x0,
+       LCM_FL_RDONLY           = 0x1,
+       LCM_FL_WRITE_PENDING    = 0x2,
+       LCM_FL_SYNC_PENDING     = 0x3,
+       LCM_FL_PCC_RDONLY       = 0x8,
+       LCM_FL_FLR_MASK         = 0xB,
 };
 
 struct lov_comp_md_v1 {
 };
 
 struct lov_comp_md_v1 {
index 2d7875c..ad0bfbe 100644 (file)
@@ -238,7 +238,7 @@ struct lod_object {
                        __u16           ldo_mirror_count;
                        struct lod_mirror_entry *ldo_mirrors;
                        __u32           ldo_is_composite:1,
                        __u16           ldo_mirror_count;
                        struct lod_mirror_entry *ldo_mirrors;
                        __u32           ldo_is_composite:1,
-                                       ldo_flr_state:2,
+                                       ldo_flr_state:4,
                                        ldo_comp_cached:1,
                                        ldo_is_foreign:1;
                };
                                        ldo_comp_cached:1,
                                        ldo_is_foreign:1;
                };
index 9724fec..bcd8a08 100644 (file)
@@ -1867,6 +1867,8 @@ void lustre_assert_wire_constants(void)
                 (long long)LCM_FL_WRITE_PENDING);
        LASSERTF(LCM_FL_SYNC_PENDING == 3, "found %lld\n",
                 (long long)LCM_FL_SYNC_PENDING);
                 (long long)LCM_FL_WRITE_PENDING);
        LASSERTF(LCM_FL_SYNC_PENDING == 3, "found %lld\n",
                 (long long)LCM_FL_SYNC_PENDING);
+       LASSERTF(LCM_FL_PCC_RDONLY == 8, "found %lld\n",
+                (long long)LCM_FL_PCC_RDONLY);
 
        /* Checks for struct lmv_mds_md_v1 */
        LASSERTF((int)sizeof(struct lmv_mds_md_v1) == 56, "found %lld\n",
 
        /* Checks for struct lmv_mds_md_v1 */
        LASSERTF((int)sizeof(struct lmv_mds_md_v1) == 56, "found %lld\n",
index 2911910..a9b8ef3 100644 (file)
@@ -1892,6 +1892,8 @@ void lustre_assert_wire_constants(void)
                 (long long)LCM_FL_WRITE_PENDING);
        LASSERTF(LCM_FL_SYNC_PENDING == 3, "found %lld\n",
                 (long long)LCM_FL_SYNC_PENDING);
                 (long long)LCM_FL_WRITE_PENDING);
        LASSERTF(LCM_FL_SYNC_PENDING == 3, "found %lld\n",
                 (long long)LCM_FL_SYNC_PENDING);
+       LASSERTF(LCM_FL_PCC_RDONLY == 8, "found %lld\n",
+                (long long)LCM_FL_PCC_RDONLY);
 
        /* Checks for struct lmv_mds_md_v1 */
        LASSERTF((int)sizeof(struct lmv_mds_md_v1) == 56, "found %lld\n",
 
        /* Checks for struct lmv_mds_md_v1 */
        LASSERTF((int)sizeof(struct lmv_mds_md_v1) == 56, "found %lld\n",