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

lod_add_device() may free an already added target description

Details

    • Bug
    • Resolution: Fixed
    • Major
    • Lustre 2.8.0
    • Lustre 2.8.0
    • 3
    • 9223372036854775807

    Description

      In the error path of lod_add_device() we may free tgt_desc after adding it to the ldt:

              LTD_TGT(ltd, index) = tgt_desc;
              cfs_bitmap_set(ltd->ltd_tgt_bitmap, index);
              ltd->ltd_tgtnr++;
              mutex_unlock(&ltd->ltd_mutex);
              lod_putref(lod, ltd);
              lock = false;
              if (lod->lod_recovery_completed)
                      ldev->ld_ops->ldo_recovery_complete(env, ldev);
      
              if (!for_ost && lod->lod_initialized) {
                      rc = lod_sub_init_llog(env, lod, tgt_desc->ltd_tgt);
                      if (rc != 0) {
                              CERROR("%s: cannot start llog on %s:rc = %d\n",
                                     lod2obd(lod)->obd_name, osp, rc);
                              GOTO(out_pool, rc);
                      }
              }
      
              rc = lfsck_add_target(env, lod->lod_child, d, exp, index, for_ost);
              if (rc != 0) {
                      CERROR("Fail to add LFSCK target: name = %s, type = %s, "
                             "index = %u, rc = %d\n", osp, type, index, rc);
                      GOTO(out_fini_llog, rc);
              }
              RETURN(rc);
      out_fini_llog:
              lod_sub_fini_llog(env, tgt_desc->ltd_tgt,
                                tgt_desc->ltd_recovery_thread);
      out_pool:
              lod_ost_pool_remove(&lod->lod_pool_info, index);
      out_mutex:
              if (lock) {
                      mutex_unlock(&ltd->ltd_mutex);
                      lod_putref(lod, ltd);
              }
      out_desc:
              OBD_FREE_PTR(tgt_desc);
      

      Attachments

        Activity

          [LU-7065] lod_add_device() may free an already added target description

          Landed to 2.8

          dmiter Dmitry Eremin (Inactive) added a comment - Landed to 2.8

          Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/16441/
          Subject: LU-7065 lod: Fix free of already added target description
          Project: fs/lustre-release
          Branch: master
          Current Patch Set:
          Commit: dd745f94bf0fac0d4042f46c8faba1b61d3b9fb3

          gerrit Gerrit Updater added a comment - Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/16441/ Subject: LU-7065 lod: Fix free of already added target description Project: fs/lustre-release Branch: master Current Patch Set: Commit: dd745f94bf0fac0d4042f46c8faba1b61d3b9fb3

          Dmitry Eremin (dmitry.eremin@intel.com) uploaded a new patch: http://review.whamcloud.com/16441
          Subject: LU-7065 lod: Fix free of already added target description
          Project: fs/lustre-release
          Branch: master
          Current Patch Set: 1
          Commit: c191f84b1518c94416cc9ac25cb4a9a78cc06842

          gerrit Gerrit Updater added a comment - Dmitry Eremin (dmitry.eremin@intel.com) uploaded a new patch: http://review.whamcloud.com/16441 Subject: LU-7065 lod: Fix free of already added target description Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: c191f84b1518c94416cc9ac25cb4a9a78cc06842

          Looks like this was added in http://review.whamcloud.com/11408 (commit v2_7_54_0-43-g4dcd475) but it may lead to a crash and should be fixed for 2.8.0.

          adilger Andreas Dilger added a comment - Looks like this was added in http://review.whamcloud.com/11408 (commit v2_7_54_0-43-g4dcd475) but it may lead to a crash and should be fixed for 2.8.0.

          Hi Dmitry,
          Can you look into this issue?
          Thanks.
          Joe

          jgmitter Joseph Gmitter (Inactive) added a comment - Hi Dmitry, Can you look into this issue? Thanks. Joe

          People

            dmiter Dmitry Eremin (Inactive)
            jhammond John Hammond
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: