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

osd_inode_iteration err ptr dereference, wrong bitmap checks in osd scrub

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • Lustre 2.15.0
    • Lustre 2.15.0
    • None
    • 3
    • 9223372036854775807

    Description

      it looks like osd_inode_iteration and all around code in osd-ldiskfs/osd_scrub.c is incorrect

      osd_inode_iteration:

                      param->bitmap = ldiskfs_read_inode_bitmap(param->sb, param->bg);
                      if (!param->bitmap) {
                              CERROR("%s: fail to read bitmap for %u, "
                                     "scrub will stop, urgent mode\n",
                                     osd_scrub2name(scrub), (__u32)param->bg);
                              RETURN(-EIO);
                      }
       

      But the comment in ldiskfs_read_inode_bitmap() is incorrect:

       * Return buffer_head of bitmap on success or NULL.
       */
      struct buffer_head *
      ldiskfs_read_inode_bitmap(struct super_block *sb, ldiskfs_group_t block_group)
      {
              struct ldiskfs_group_desc *desc;
              struct ldiskfs_sb_info *sbi = LDISKFS_SB(sb);
              struct buffer_head *bh = NULL;
              ldiskfs_fsblk_t bitmap_blk;
              int err;        desc = ldiskfs_get_group_desc(sb, block_group, NULL);
              if (!desc)
                      return ERR_PTR(-EFSCORRUPTED);
      ...
                      return ERR_PTR(-EIO);
       

      and so on.

      this is not the case in centos7, but on rhel8 is already affected

      Attachments

        Activity

          [LU-15601] osd_inode_iteration err ptr dereference, wrong bitmap checks in osd scrub
          pjones Peter Jones added a comment -

          Landed for 2.15

          pjones Peter Jones added a comment - Landed for 2.15

          "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/46660/
          Subject: LU-15601 osd-ldiskfs: handle read_inode_bitmap() error
          Project: fs/lustre-release
          Branch: master
          Current Patch Set:
          Commit: 06134ff9addec8c74af78dd0f361f503ef8d3ba6

          gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/46660/ Subject: LU-15601 osd-ldiskfs: handle read_inode_bitmap() error Project: fs/lustre-release Branch: master Current Patch Set: Commit: 06134ff9addec8c74af78dd0f361f503ef8d3ba6

          "Andreas Dilger <adilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/46660
          Subject: LU-15601 osd-ldiskfs: handle read_inode_bitmap() error
          Project: fs/lustre-release
          Branch: master
          Current Patch Set: 1
          Commit: ee840530156ad961c3340428a0e01c7bafec23a6

          gerrit Gerrit Updater added a comment - "Andreas Dilger <adilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/46660 Subject: LU-15601 osd-ldiskfs: handle read_inode_bitmap() error Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: ee840530156ad961c3340428a0e01c7bafec23a6

          Looks like the osd-ldiskfs code should be changed to use IS_ERR_OR_NULL() so it works with both kernels.

          adilger Andreas Dilger added a comment - Looks like the osd-ldiskfs code should be changed to use IS_ERR_OR_NULL() so it works with both kernels.

          People

            adilger Andreas Dilger
            green Oleg Drokin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: