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

OBD_FREE macro issues with OBD_DEBUG_MEMUSAGE and CONFIG_DEBUG_SLAB

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      There's some weirdness with the OBD_FREE family of macros, and at least one bug.

      First item is more of a style thing, but:
      free(), vfree(), and kfree() all accept null pointers without complaint.  This simplifies code in exit paths in many places.

      The OBD_FREE macros do in their default version, and this behavior is used (inconsistently), but if OBD_DEBUG_MEMUSAGE is on, they do not, because OBD_FREE_PRE asserts the pointer is not null.

      We should fix that in OBD_DEBUG_MEMUSAGE;

      Then, next:

      There are several bugs with POISON_PTR.

      If OBD_DEBUG_MEMUSAGE is on:
      OBD_FREE poisons the PTR twice.

      if CONFIG_DEBUG_SLAB is on, POISON_PTR is enabled...

      And we call it after freeing the pointer in several places:
      #define OBD_FREE(ptr, size) \
      do { \
      OBD_FREE_PRE(ptr, size, "kfreed"); \
      kfree(ptr); \
      POISON_PTR(ptr); \
      } while (0)

      #define OBD_FREE_LARGE(ptr, size) \
      do { \
      if (is_vmalloc_addr(ptr))

      { \ OBD_FREE_PRE(ptr, size, "vfreed"); \ vfree(ptr); \ POISON_PTR(ptr); \ }

      else {

       

      Yuck!  I'll see about doing patches for this at some point.

      Attachments

        Activity

          People

            wc-triage WC Triage
            pfarrell Patrick Farrell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: