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

Incorrect return value for llog_cancel_rec()

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.10.0
    • Lustre 2.8.0, Lustre 2.9.0, Lustre 2.10.0
    • None
    • 3
    • 9223372036854775807

    Description

      This problem is brought by http://review.whamcloud.com/16333

                      rc = llog_trans_destroy(env, loghandle, th);
                      if (rc < 0) {
                              /* Sigh, can not destroy the final plain llog, but
                               * the bitmap has been cleared, so the record cannot
                               * be accessed anymore. Let's return 0 for now, and
                               * the orphan will be handled by LFSCK.
                               */
                              CERROR("%s: can't kill empty llog "DFID":%x: rc = %d\n",
                                     loghandle->lgh_ctxt->loc_obd->obd_name,
                                     PFID(&loghandle->lgh_id.lgl_oi.oi_fid),
                                     loghandle->lgh_id.lgl_ogen, rc);
                              GOTO(out_unlock, rc);
                      }
      

      If llog cancel is failed, it should still return 0 as commented by the above comments. Initially this returning rc is for restoring the lgh_count if destroy failed, so if this is reverted back to "GOTO(out_unlock, rc = 0);", then the following

              if (rc < 0 && subtract_count) {
                      mutex_lock(&loghandle->lgh_hdr_mutex);
                      loghandle->lgh_hdr->llh_count++;
                      ext2_set_bit(index, LLOG_HDR_BITMAP(llh));
                      mutex_unlock(&loghandle->lgh_hdr_mutex);
              }
      

      needs to be resolved without rc < 0.

      Attachments

        Issue Links

          Activity

            [LU-9197] Incorrect return value for llog_cancel_rec()
            pjones Peter Jones made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Open [ 1 ] New: Resolved [ 5 ]
            di.wang Di Wang made changes -
            Description Original: {noformat}
                            rc = llog_trans_destroy(env, loghandle, th);
                            if (rc < 0) {
                                    /* Sigh, can not destroy the final plain llog, but
                                     * the bitmap has been cleared, so the record cannot
                                     * be accessed anymore. Let's return 0 for now, and
                                     * the orphan will be handled by LFSCK.
                                     */
                                    CERROR("%s: can't kill empty llog "DFID":%x: rc = %d\n",
                                           loghandle->lgh_ctxt->loc_obd->obd_name,
                                           PFID(&loghandle->lgh_id.lgl_oi.oi_fid),
                                           loghandle->lgh_id.lgl_ogen, rc);
                                    GOTO(out_unlock, rc);
                            }
            {noformat}

            If llog cancel is failed, it should still return 0 as commented by the above comments. Initially this returning rc is for restoring the lgh_count if destroy failed, so if this is reverted back to "GOTO(out_unlock, rc = 0);", then the following
            {noformat}
                    if (rc < 0 && subtract_count) {
                            mutex_lock(&loghandle->lgh_hdr_mutex);
                            loghandle->lgh_hdr->llh_count++;
                            ext2_set_bit(index, LLOG_HDR_BITMAP(llh));
                            mutex_unlock(&loghandle->lgh_hdr_mutex);
                    }
            {noformat}

            needs to be resolved without rc < 0.

            New: This problem is brought by http://review.whamcloud.com/16333
            {noformat}
                            rc = llog_trans_destroy(env, loghandle, th);
                            if (rc < 0) {
                                    /* Sigh, can not destroy the final plain llog, but
                                     * the bitmap has been cleared, so the record cannot
                                     * be accessed anymore. Let's return 0 for now, and
                                     * the orphan will be handled by LFSCK.
                                     */
                                    CERROR("%s: can't kill empty llog "DFID":%x: rc = %d\n",
                                           loghandle->lgh_ctxt->loc_obd->obd_name,
                                           PFID(&loghandle->lgh_id.lgl_oi.oi_fid),
                                           loghandle->lgh_id.lgl_ogen, rc);
                                    GOTO(out_unlock, rc);
                            }
            {noformat}

            If llog cancel is failed, it should still return 0 as commented by the above comments. Initially this returning rc is for restoring the lgh_count if destroy failed, so if this is reverted back to "GOTO(out_unlock, rc = 0);", then the following
            {noformat}
                    if (rc < 0 && subtract_count) {
                            mutex_lock(&loghandle->lgh_hdr_mutex);
                            loghandle->lgh_hdr->llh_count++;
                            ext2_set_bit(index, LLOG_HDR_BITMAP(llh));
                            mutex_unlock(&loghandle->lgh_hdr_mutex);
                    }
            {noformat}

            needs to be resolved without rc < 0.

            di.wang Di Wang made changes -
            Link New: This issue is related to LU-6846 [ LU-6846 ]
            di.wang Di Wang created issue -

            People

              di.wang Di Wang
              di.wang Di Wang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: