Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-3825

mdt_hsm_release() clobbers ma_valid

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Minor
    • None
    • Lustre 2.5.0
    • 3
    • 9871

    Description

      In mdt_hsm_release() we have:

              ma->ma_need = MA_HSM | MA_LOV;
              rc = mdt_attr_get_complex(info, o, ma);
              if (rc != 0)
                      GOTO(out_unlock, rc);
      
              ...
      
              ma->ma_valid = MA_INODE;
              ma->ma_attr.la_valid &= LA_SIZE | LA_MTIME | LA_ATIME;
              rc = mo_attr_set(info->mti_env, mdt_object_child(o), ma);
              if (rc < 0)
                      GOTO(out_unlock, rc);
      
              if (!(ma->ma_valid & MA_LOV)) {
                      /* Even empty file are released */
                      memset(ma->ma_lmm, 0, sizeof(*ma->ma_lmm));
                      ma->ma_lmm->lmm_magic = cpu_to_le32(LOV_MAGIC_V1_DEF);
                      ma->ma_lmm->lmm_pattern = cpu_to_le32(LOV_PATTERN_RAID0);
      		ma->ma_lmm->lmm_stripe_size = cpu_to_le32(LOV_MIN_STRIPE_SIZE);
                      ma->ma_valid |= MA_LOV;
              } else {
                      /* Magic must be LOV_MAGIC_Vx_DEF otherwise LOD will interpret            
                       * ma_lmm as lov_user_md, then it will be confused by union of            
                       * layout_gen and stripe_offset. */
                      if (le32_to_cpu(ma->ma_lmm->lmm_magic) == LOV_MAGIC_V1)
                              ma->ma_lmm->lmm_magic = cpu_to_le32(LOV_MAGIC_V1_DEF);
      		else if (le32_to_cpu(ma->ma_lmm->lmm_magic) == LOV_MAGIC_V3)
                              ma->ma_lmm->lmm_magic = cpu_to_le32(LOV_MAGIC_V3_DEF);
                      else
                              GOTO(out_unlock, rc = -EINVAL);
              }
      

      Attachments

        Issue Links

          Activity

            People

              jhammond John Hammond
              jhammond John Hammond
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: