Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.10.0
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      This issue can be reproduced by the following steps:

      mkdir /mnt/lustre/dir1
      mkdir /mnt/lustre/dir2
      lfs setstripe -c 3 /mnt/lustre/dir1/file
      lfs setstripe -c 3 /mnt/lustre/dir2/file
      lfs find /mnt/lustre -c 3
      

      Then, you will see the output is

      /mnt/lustre/dir1/file
      /mnt/lustre/dir2
      /mnt/lustre/dir2/file
      

      I will create a fix.

      Attachments

        Activity

          [LU-9369] lfs find can't work correctly
          pjones Peter Jones added a comment -

          Landed for 2.10

          pjones Peter Jones added a comment - Landed for 2.10

          Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/26914/
          Subject: LU-9369 lfs: make lfs find work correctly
          Project: fs/lustre-release
          Branch: master
          Current Patch Set:
          Commit: b0404c136240a578655554d37689b47b47ef5920

          gerrit Gerrit Updater added a comment - Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/26914/ Subject: LU-9369 lfs: make lfs find work correctly Project: fs/lustre-release Branch: master Current Patch Set: Commit: b0404c136240a578655554d37689b47b47ef5920

          Emoly Liu (emoly.liu@intel.com) uploaded a new patch: https://review.whamcloud.com/26914
          Subject: LU-9369 lfs: make lfs find work correctly
          Project: fs/lustre-release
          Branch: master
          Current Patch Set: 1
          Commit: 01ee10671587faab7a30284e78022f1a16a9e800

          gerrit Gerrit Updater added a comment - Emoly Liu (emoly.liu@intel.com) uploaded a new patch: https://review.whamcloud.com/26914 Subject: LU-9369 lfs: make lfs find work correctly Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 01ee10671587faab7a30284e78022f1a16a9e800
          emoly.liu Emoly Liu added a comment -

          Niu, thanks for your patch! It does fix this issue.

          emoly.liu Emoly Liu added a comment - Niu, thanks for your patch! It does fix this issue.

          I think it could be an old bug, cb_find_init() mistakenly used previous file's lum for the next dir, because the dir doesn't have default layout. Old code happen to zeroed the stripe count every time, that's probably why 'lfs find -c' works for old code. I think other options such as 'lfs find -S' would fail on old code too. Could you verify this?

          diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c
          index 23691fb..42da570 100644
          --- a/lustre/utils/liblustreapi.c
          +++ b/lustre/utils/liblustreapi.c
          @@ -3338,6 +3338,8 @@ static int cb_find_init(char *path, DIR *parent, DIR **dirp,
                                  if (ret != 0)
                                          return ret;
                          }
          +
          +               param->fp_lmd->lmd_lmm.lmm_magic = 0;
                          ret = get_lmd_info(path, parent, dir, param->fp_lmd,
                                             param->fp_lum_size);
                          if (ret == 0 && param->fp_lmd->lmd_lmm.lmm_magic == 0 &&
          

          I think above patch can fix the problem.

          niu Niu Yawei (Inactive) added a comment - I think it could be an old bug, cb_find_init() mistakenly used previous file's lum for the next dir, because the dir doesn't have default layout. Old code happen to zeroed the stripe count every time, that's probably why 'lfs find -c' works for old code. I think other options such as 'lfs find -S' would fail on old code too. Could you verify this? diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 23691fb..42da570 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -3338,6 +3338,8 @@ static int cb_find_init( char *path, DIR *parent, DIR **dirp, if (ret != 0) return ret; } + + param->fp_lmd->lmd_lmm.lmm_magic = 0; ret = get_lmd_info(path, parent, dir, param->fp_lmd, param->fp_lum_size); if (ret == 0 && param->fp_lmd->lmd_lmm.lmm_magic == 0 && I think above patch can fix the problem.
          emoly.liu Emoly Liu added a comment -

          This issue is related to the PFL patch https://review.whamcloud.com/#/c/26391

          emoly.liu Emoly Liu added a comment - This issue is related to the PFL patch https://review.whamcloud.com/#/c/26391

          People

            emoly.liu Emoly Liu
            emoly.liu Emoly Liu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: