[Ocfs2-devel] [PATCH 05/18] ocfs2_dlm: Add missing
dlm_lockres_put()s
Joel Becker
Joel.Becker at oracle.com
Thu Feb 28 14:48:21 PST 2008
On Mon, Feb 25, 2008 at 12:20:49PM -0800, Sunil Mushran wrote:
> This patch adds few missing puts in dlm_master_request_handler().
dlm_master_request_handler() forgot to put a lockres when
dlm_assert_master_worker() failed or was skipped.
> --- a/fs/ocfs2/dlm/dlmmaster.c
> +++ b/fs/ocfs2/dlm/dlmmaster.c
> @@ -1718,7 +1718,13 @@ send_response:
> if (ret < 0) {
> mlog(ML_ERROR, "failed to dispatch assert master work\n");
> response = DLM_MASTER_RESP_ERROR;
> + /* incase dlm_assert_master_worker() was not called */
> + dlm_lockres_put(res);
> }
> + } else {
> + /* match the put in dlm_assert_master_worker() */
> + if (res)
> + dlm_lockres_put(res);
The put()s are correct, but I'd remove those comments and place
a comment above the whole if() block. The comments you have assume more
knowledge of the flow than is obvious.
+ /*
+ * __dlm_lookup_lockres() grabbed a reference to this lockres.
+ * The reference is released by dlm_assert_master_worker() under
+ * the call to dlm_dispatch_assert_master(). If
+ * dlm_assert_master_worker() isn't called, we drop it here.
+ */
if (dispatch_assert) {
Joel
--
Life's Little Instruction Book #252
"Take good care of those you love."
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
More information about the Ocfs2-devel
mailing list