From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Mon, 9 Jul 2018 12:50:18 -0500 Subject: [Cluster-devel] [GFS2 PATCH 02/12] GFS2: Eliminate a goto in finish_xmote In-Reply-To: <20180709175028.17090-1-rpeterso@redhat.com> References: <20180709175028.17090-1-rpeterso@redhat.com> Message-ID: <20180709175028.17090-3-rpeterso@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This is another baby step toward a better glock state machine. This patch eliminates a goto in function finish_xmote so we can begin unraveling the cryptic logic with later patches. Signed-off-by: Bob Peterson --- fs/gfs2/glock.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 8d0c467f8c9a..8f2721515ff5 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -472,11 +472,11 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret) list_move_tail(&gh->gh_list, &gl->gl_holders); gh = find_first_waiter(gl); gl->gl_target = gh->gh_state; - goto retry; - } - /* Some error or failed "try lock" - report it */ - if ((ret & LM_OUT_ERROR) || - (gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) { + state = LM_ST_UNLOCKED; + } else if ((ret & LM_OUT_ERROR) || + (gh->gh_flags & (LM_FLAG_TRY | + LM_FLAG_TRY_1CB))) { + /* An error or failed "try lock" - report it */ gl->gl_target = gl->gl_state; do_error(gl, ret); goto out; @@ -485,7 +485,6 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret) switch(state) { /* Unlocked due to conversion deadlock, try again */ case LM_ST_UNLOCKED: -retry: do_xmote(gl, gl->gl_target); break; /* Conversion fails, unlock and try again */ -- 2.17.1