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

nodemap key hash comparison is broken

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • Lustre 2.7.0
    • Lustre 2.6.0
    • 3
    • 13758

    Description

      The key hash comparison function nodemap_hs_keycmp() used for nodemap is broken:

      static void *nodemap_hs_key(cfs_hlist_node_t *hnode)
      {
              struct lu_nodemap *nodemap;
      
              nodemap = cfs_hlist_entry(hnode, struct lu_nodemap, nm_hash);
      
              return nodemap->nm_name;
      }
      
      static int nodemap_hs_keycmp(const void *key,
                                   cfs_hlist_node_t *compared_hnode)
      {
              struct lu_nodemap *nodemap;
      
              nodemap = nodemap_hs_key(compared_hnode);
      
              return !strcmp(key, nodemap->nm_name);
      }
      

      The nodemap_hs_key() function returns a pointer to the nodemap name, but then nodemap_hs_keycmp() dereferences this again to try and get the name.

      Since this function is only used when resizing the hash table, it would not be hit until the initial hash table size is getting too full (looks like about 128 entries or so). I think this could be fixed by just using the return value from nodemap_hs_key() directly:

      static int nodemap_hs_keycmp(const void *key,
                                   cfs_hlist_node_t *compared_hnode)
      {
              return !strcmp(key, nodemap_hs_key(compared_hnode));
      }
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: