Commit 4250e683 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher
Browse files

gfs2: Simplify refcounting in do_xmote



In do_xmote(), take the additional glock references close to where those
references are needed.  This will simplify the next commit.

Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: default avatarAndrew Price <anprice@redhat.com>
parent 2309a013
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -760,7 +760,6 @@ __acquires(&gl->gl_lockref.lock)
	spin_lock(&gl->gl_lockref.lock);

skip_inval:
	gl->gl_lockref.count++;
	/*
	 * Check for an error encountered since we called go_sync and go_inval.
	 * If so, we can't withdraw from the glock code because the withdraw
@@ -803,6 +802,7 @@ __acquires(&gl->gl_lockref.lock)
			if (!test_bit(GLF_CANCELING, &gl->gl_flags))
				clear_bit(GLF_LOCK, &gl->gl_flags);
			clear_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
			gl->gl_lockref.count++;
			gfs2_glock_queue_work(gl, GL_GLOCK_DFT_HOLD);
			return;
		} else {
@@ -818,6 +818,7 @@ __acquires(&gl->gl_lockref.lock)

		if (!ret) {
			/* The operation will be completed asynchronously. */
			gl->gl_lockref.count++;
			return;
		}
		clear_bit(GLF_PENDING_REPLY, &gl->gl_flags);
@@ -837,6 +838,7 @@ __acquires(&gl->gl_lockref.lock)

	/* Complete the operation now. */
	finish_xmote(gl, target);
	gl->gl_lockref.count++;
	gfs2_glock_queue_work(gl, 0);
}