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

Memory leak occurs when lfs mkdir fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Minor
    • None
    • Lustre 2.10.5
    • None
    • 3
    • 9223372036854775807

    Description

      When lfs mkdir fails, llog_cat_cancel_records() is executed for error handling. But, in a condition of !llog_exist(loghandle), llog_handle_put() is not executed (that is, lgh_refcount is not decremented), so llog_free_handle() will not be executed in umount. This cause memory leak.

       

       682 int llog_cat_cancel_records(const struct lu_env *env,
       683 struct llog_handle *cathandle, int count,
       684 struct llog_cookie *cookies)
       685 {
       686 int i, index, rc = 0, failed = 0;
       687
       688 ENTRY;
       689
       690 for (i = 0; i < count; i++, cookies++) {
       691 struct llog_handle *loghandle;
       692 struct llog_logid *lgl = &cookies->lgc_lgl;
       693 int lrc;
       694
       695 rc = llog_cat_id2handle(env, cathandle, &loghandle, lgl);
       // llog_cat_id2handle(llog_handle_get) increments lgh_refcount
      <snip>
       705 if ((cathandle->lgh_ctxt->loc_flags &
       706 LLOG_CTXT_FLAG_NORMAL_FID) && !llog_exist(loghandle)) {
       707 /* For update log, some of loghandles of cathandle
       708 * might not exist because remote llog creation might
       709 * be failed, so let's skip the record cancellation
       710 * for these non-exist llogs.
       711 */
       712 lrc = -ENOENT;
       713 CDEBUG(D_HA, "%s: llog "DFID":%x does not exist"
       714 ": rc = %d\n",
       715 cathandle->lgh_ctxt->loc_obd->obd_name,
       716 PFID(&lgl->lgl_oi.oi_fid), lgl->lgl_ogen, lrc);
       717 failed++;
       718 if (rc == 0)
       719 rc = lrc;
       // llog_handle_put() should be called to decrement lgh_refcount
       720 continue;
       721 }
      

       

      Attachments

        Issue Links

          Activity

            People

              takamura Tatsushi Takamura
              takamura Tatsushi Takamura
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: