Skip to content

Commit

Permalink
Fix bad ref counting on async close failures
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Jul 10, 2024
1 parent 96acf6c commit df601a9
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/H5A.c
Original file line number Diff line number Diff line change
Expand Up @@ -2244,8 +2244,9 @@ H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set");

done:
if (connector && H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");
if (connector && (H5ES_NONE != es_id))
if (H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");

FUNC_LEAVE_API(ret_value)
} /* H5Aclose_async() */
Expand Down
5 changes: 3 additions & 2 deletions src/H5D.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,9 @@ H5Dclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set");

done:
if (connector && H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");
if (connector && (H5ES_NONE != es_id))
if (H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");

FUNC_LEAVE_API(ret_value)
} /* end H5Dclose_async() */
Expand Down
5 changes: 3 additions & 2 deletions src/H5F.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,8 +1104,9 @@ H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set");

done:
if (connector && H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");
if (connector && (H5ES_NONE != es_id))
if (H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");

FUNC_LEAVE_API(ret_value)
} /* end H5Fclose_async() */
Expand Down
5 changes: 3 additions & 2 deletions src/H5G.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,9 @@ H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set");

done:
if (connector && H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");
if (connector && (H5ES_NONE != es_id))
if (H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");

FUNC_LEAVE_API(ret_value)
} /* end H5Gclose_async() */
Expand Down
5 changes: 3 additions & 2 deletions src/H5M.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,9 @@ H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set");

done:
if (connector && H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");
if (connector && (H5ES_NONE != es_id))
if (H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");

FUNC_LEAVE_API(ret_value)
} /* end H5Mclose_async() */
Expand Down
5 changes: 3 additions & 2 deletions src/H5O.c
Original file line number Diff line number Diff line change
Expand Up @@ -1967,8 +1967,9 @@ H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set");

done:
if (connector && H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");
if (connector && (H5ES_NONE != es_id))
if (H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");

FUNC_LEAVE_API(ret_value)
} /* end H5Oclose_async() */
Expand Down
5 changes: 3 additions & 2 deletions src/H5T.c
Original file line number Diff line number Diff line change
Expand Up @@ -2127,8 +2127,9 @@ H5Tclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set");

done:
if (connector && H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");
if (connector && (H5ES_NONE != es_id))
if (H5VL_conn_dec_rc(connector) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");
FUNC_LEAVE_API(ret_value)
} /* end H5Tclose_async() */
Expand Down

0 comments on commit df601a9

Please sign in to comment.