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

lfs hsm_set --dirty --archive_id 1 on not archived file returns 0 with mdt rejects the request

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • Lustre 2.15.7
    • None
    • 3
    • 9223372036854775807

      When we use the lfs hsm_set command to set the file's hsm state, for a file that has HS_NONE state, --dirty returns 22 (EINVAL). When using --dirty --archive_id 1, it retuns success, but the mdt side actually rejects the setting, instrumentation with trace shows mdt fails the op, but returns rc as 0. It should return EINVAL since mdt rejects the request.

      The following is the repro steps:

       

      echo "hello " >> a.txt
      sudo lfs path2fid a.txt
      [0x200000401:0xc3ba:0x0]
      sudo lfs hsm_state a.txt
      a.txt: (0x00000000)
       
      sudo  lfs hsm_set a.txt --dirty --archive-id 1
      echo $?
      0
       
      sudo lfs hsm_state a.txt
      a.txt: (0x00000000)
      sudo  lfs hsm_set a.txt --dirty
      Can't change hsm flags for a.txt: Invalid argument
      echo $?
      22
       
      

      Review code (lustre/mdt/mdt_hsm.c) shows:

       

      int mdt_hsm_state_set(struct tgt_session_info *tsi)
       ......
              /* Change archive_id if provided. */
              if (hss->hss_valid & HSS_ARCHIVE_ID) {
                      struct ptlrpc_request *req = mdt_info_req(info);
                      struct obd_export *exp = req->rq_export;
                      if (!(ma->ma_hsm.mh_flags & HS_EXISTS)) {
                            CDEBUG(D_HSM, "Could not set an archive number for "
                                           DFID "if HSM EXISTS flag is not set.\n",
                                           PFID(&info->mti_body->mbo_fid1));
          ====>                        GOTO(out_unlock, rc);
                        }
      

       

      rc was set to 0. As result, it will return the 0 to the client.

      mdt trace shows:

       

      00000004:20000000:9.0:1775875099.458814:0:7575:0:(mdt_hsm.c:395:mdt_hsm_state_set()) Could not set an archive number for [0x200000401:0xc3ba:0x0]if HSM EXISTS flag is not set.
       
      

      It should return EINVAL to client since mdt rejects the invalid setting.

            wc-triage WC Triage
            tjiang Tianyu Jiang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: