summaryrefslogtreecommitdiff
path: root/fs/gfs2
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2025-08-02 23:41:24 +0200
committerAndreas Gruenbacher <agruenba@redhat.com>2025-09-12 12:02:06 +0200
commit4250e683de69a637b93f7c7bda7818b36b1cf32e (patch)
tree4a91f0e36b9d753a33f93f39f93e3da0d85e36ec /fs/gfs2
parent2309a01351e56446f43c89e200d643647d47e739 (diff)
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>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/glock.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index f1383e9445be..8a7f947883cd 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -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 @@ skip_inval:
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 @@ skip_inval:
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 @@ skip_inval:
/* Complete the operation now. */
finish_xmote(gl, target);
+ gl->gl_lockref.count++;
gfs2_glock_queue_work(gl, 0);
}