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

mdd_write_lock leaks

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.7.0
    • Lustre 2.7.0
    • 3
    • 15054

    Description

      In mdd_open() and mdd_migrate_update_name() there are error paths that leak a write lock on an object.

      static int mdd_open(const struct lu_env *env, struct md_object *obj,
                          int flags)
      {
              struct mdd_object *mdd_obj = md2mdd_obj(obj);
              struct lu_attr *attr = MDD_ENV_VAR(env, cattr);
              int rc = 0;
      
              mdd_write_lock(env, mdd_obj, MOR_TGT_CHILD);
      
              rc = mdd_la_get(env, mdd_obj, attr, BYPASS_CAPA);
              if (rc)
                      RETURN(rc);
      
              rc = mdd_open_sanity_check(env, mdd_obj, attr, flags);
              if (rc == 0)
                      mdd_obj->mod_count++;
      
              mdd_write_unlock(env, mdd_obj);
              return rc;
      }
      
      mdd_migrate_update_name()
              mdd_write_lock(env, mdd_sobj, MOR_SRC_CHILD);
              mdo_ref_del(env, mdd_sobj, handle);
              if (is_dir)
                      mdo_ref_del(env, mdd_sobj, handle);
      
              /* Get the attr again after ref_del */
              rc = mdd_la_get(env, mdd_sobj, so_attr,
              		mdd_object_capa(env, mdd_sobj));
              if (rc != 0)
              	GOTO(stop_trans, rc);
              ma->ma_attr = *so_attr;
              ma->ma_valid |= MA_INODE;
              rc = mdd_finish_unlink(env, mdd_sobj, ma, mdd_pobj, lname, handle);
              if (rc != 0)
                      GOTO(stop_trans, rc);
      
              rc = mdd_attr_set_internal(env, mdd_pobj, p_la, handle, 0);
              if (rc != 0)
                      GOTO(stop_trans, rc);
      
              mdd_write_unlock(env, mdd_sobj);
      
      stop_trans:
              mdd_trans_stop(env, mdd, rc, handle);
      
              RETURN(rc);
      }
      

      This was found through DT API fault injection.

      Attachments

        Issue Links

          Activity

            People

              jhammond John Hammond
              jhammond John Hammond
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: