Skip to content

Commit 4250e68

Browse files
author
Andreas Gruenbacher
committed
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: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Andrew Price <anprice@redhat.com>
1 parent 2309a01 commit 4250e68

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

fs/gfs2/glock.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,6 @@ __acquires(&gl->gl_lockref.lock)
760760
spin_lock(&gl->gl_lockref.lock);
761761

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

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

838839
/* Complete the operation now. */
839840
finish_xmote(gl, target);
841+
gl->gl_lockref.count++;
840842
gfs2_glock_queue_work(gl, 0);
841843
}
842844

0 commit comments

Comments
 (0)