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

hsm: userspace can set about any HSM flags. Checks are inexistant.

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.8.0
    • Lustre 2.7.0, Lustre 2.5.3
    • 3
    • 16155

    Description

      Creating, opening and executing the following commands on a regular file:

      rc = llapi_hsm_state_set_fd(fd, HS_EXISTS, 0, -1789);
      rc = llapi_hsm_state_set_fd(fd, HS_DIRTY, 0, 0);
      rc = llapi_hsm_state_set_fd(fd, 0, HS_DIRTY, 0);
      rc = llapi_hsm_state_set_fd(fd, HS_ARCHIVED, 0, 0);
      rc = llapi_hsm_state_set_fd(fd, HS_RELEASED, 0, 0);
      rc = llapi_hsm_state_set_fd(fd, HS_NORELEASE, 0, 0);
      rc = llapi_hsm_state_set_fd(fd, HS_NOARCHIVE, 0, 0);
      rc = llapi_hsm_state_set_fd(fd, HS_LOST, 0, 0);
      rc = llapi_hsm_state_set_fd(fd, 0x00080000, 0, 0);
      rc = llapi_hsm_state_set_fd(fd, 0x80000000, 0, 0);
      

      results in this:

      # ../utils/lfs hsm_state /mnt/lustre/hsm_check_test
       /mnt/lustre/hsm_check_test: (0x8008007d) released exists archived never_release never_archive lost_from_hsm, archive_id:-1789
      

      Some of these flags should not be user settable. Unknown flags should not be set. The archive_id should not be anything but >=0 (or 1?) and <=32.

      Attachments

        Issue Links

          Activity

            [LU-5757] hsm: userspace can set about any HSM flags. Checks are inexistant.
            pjones Peter Jones added a comment -

            Landed for 2.8

            pjones Peter Jones added a comment - Landed for 2.8

            Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/13337/
            Subject: LU-5757 hsm: strengthen checks for flags and archive id
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 32bd5051a518c57e35f51b7f3c7f739b5ef91b25

            gerrit Gerrit Updater added a comment - Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/13337/ Subject: LU-5757 hsm: strengthen checks for flags and archive id Project: fs/lustre-release Branch: master Current Patch Set: Commit: 32bd5051a518c57e35f51b7f3c7f739b5ef91b25
            bfaccini Bruno Faccini (Inactive) added a comment - - edited

            Robert, thanks to detail this. And Yes, using the import feature along with manual flags setting was some of the repair actions I thought about to be helpful in some cases.

            bfaccini Bruno Faccini (Inactive) added a comment - - edited Robert, thanks to detail this. And Yes, using the import feature along with manual flags setting was some of the repair actions I thought about to be helpful in some cases.
            rread Robert Read added a comment -

            I agree there are use cases for manually setting HS_DIRTY and HS_ARCHIVED, but just setting the HS_RELEASED flag is not enough to really make a file "released". The layout also needs to changed, and I don't see a way to do that directly. However, if one can clear HS_DIRTY and manually set HS_ARCHIVED, then in theory the HUA_RELEASE request should properly mark the file as released. If the file is somehow corrupted then it's also possible to use llapi_hsm_import() to recreate the released file.

            rread Robert Read added a comment - I agree there are use cases for manually setting HS_DIRTY and HS_ARCHIVED, but just setting the HS_RELEASED flag is not enough to really make a file "released". The layout also needs to changed, and I don't see a way to do that directly. However, if one can clear HS_DIRTY and manually set HS_ARCHIVED, then in theory the HUA_RELEASE request should properly mark the file as released. If the file is somehow corrupted then it's also possible to use llapi_hsm_import() to recreate the released file.

            Thanks to warn me (and to provide your add-on proposal) about the fact that some of your new tests in your patch for LU-5732 will fail. I don't know why but I was wrongly assuming that you had already anticipated the final/expected behavior and error returns from this patch in your new tests ... BTW, since I was planning to either run your new tests against this patch, or apply/relate mine on top of your or now that yours has been integrated to rebase mine, hopefully auto-tests would have also warned me!

            Concerning your remark about root being or not allowed to set/unset HS_DIRTY, HS_ARCHIVED and HS_RELEASED, my feeling is that yes it should be allowed, mainly to help fixing unusual/inconsistent situations. But this can be discussed!

            bfaccini Bruno Faccini (Inactive) added a comment - Thanks to warn me (and to provide your add-on proposal) about the fact that some of your new tests in your patch for LU-5732 will fail. I don't know why but I was wrongly assuming that you had already anticipated the final/expected behavior and error returns from this patch in your new tests ... BTW, since I was planning to either run your new tests against this patch, or apply/relate mine on top of your or now that yours has been integrated to rebase mine, hopefully auto-tests would have also warned me! Concerning your remark about root being or not allowed to set/unset HS_DIRTY, HS_ARCHIVED and HS_RELEASED, my feeling is that yes it should be allowed, mainly to help fixing unusual/inconsistent situations. But this can be discussed!

            Patch to add since LU-5732 went upstream

            fzago Frank Zago (Inactive) added a comment - Patch to add since LU-5732 went upstream

            Thanks Bruno. I've updated test test in LU-5757 (not pushed yet) and it's better.

            But should root even be allowed to set/unset the following flags: HS_DIRTY, HS_ARCHIVED and HS_RELEASED?

            fzago Frank Zago (Inactive) added a comment - Thanks Bruno. I've updated test test in LU-5757 (not pushed yet) and it's better. But should root even be allowed to set/unset the following flags: HS_DIRTY, HS_ARCHIVED and HS_RELEASED?

            Just pushed master pach http://review.whamcloud.com/13337 which should allow for HSM flags and archive-id values to be checked.

            bfaccini Bruno Faccini (Inactive) added a comment - Just pushed master pach http://review.whamcloud.com/13337 which should allow for HSM flags and archive-id values to be checked.

            Faccini Bruno (bruno.faccini@intel.com) uploaded a new patch: http://review.whamcloud.com/13337
            Subject: LU-5757 hsm: strengthen checks for flags and archive id
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 9379ce022fe908f3168987bfbc12214426f57fe8

            gerrit Gerrit Updater added a comment - Faccini Bruno (bruno.faccini@intel.com) uploaded a new patch: http://review.whamcloud.com/13337 Subject: LU-5757 hsm: strengthen checks for flags and archive id Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 9379ce022fe908f3168987bfbc12214426f57fe8

            Test for this case (test51): http://review.whamcloud.com/12836/

            fzago Frank Zago (Inactive) added a comment - Test for this case (test51): http://review.whamcloud.com/12836/

            People

              bfaccini Bruno Faccini (Inactive)
              fzago Frank Zago (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: