Skip to content

Commit 62abf26

Browse files
author
Andreas Gruenbacher
committed
gfs2: Get rid of GLF_INVALIDATE_IN_PROGRESS
JIRA: https://issues.redhat.com/browse/RHEL-116886 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git Get rid of the GLF_INVALIDATE_IN_PROGRESS flag: it was originally used to indicate to add_to_queue() that the ->go_sync() and ->go_invalid() operations were in progress, but as we have established in commit "gfs2: Fix LM_FLAG_TRY* logic in add_to_queue", add_to_queue() has no need to know. Commit d99724c describes a race in which GLF_INVALIDATE_IN_PROGRESS is used to serialize two processes which are both in do_xmote() at the same time. That analysis is wrong: the serialization happens via the GLF_LOCK flag, which ensures that at most one glock operation can be active at any time. Fixes: d99724c ("gfs2: Close timing window with GLF_INVALIDATE_IN_PROGRESS") Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> (cherry picked from commit bddb53b)
1 parent 625be2b commit 62abf26

File tree

3 files changed

+1
-17
lines changed

3 files changed

+1
-17
lines changed

fs/gfs2/glock.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -704,17 +704,6 @@ __acquires(&gl->gl_lockref.lock)
704704

705705
GLOCK_BUG_ON(gl, gl->gl_state == target);
706706
GLOCK_BUG_ON(gl, gl->gl_state == gl->gl_target);
707-
if ((target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) &&
708-
glops->go_inval) {
709-
/*
710-
* If another process is already doing the invalidate, let that
711-
* finish first. The glock state machine will get back to this
712-
* holder again later.
713-
*/
714-
if (test_and_set_bit(GLF_INVALIDATE_IN_PROGRESS,
715-
&gl->gl_flags))
716-
return;
717-
}
718707
if (!glops->go_inval || !glops->go_sync)
719708
goto skip_inval;
720709

@@ -733,7 +722,7 @@ __acquires(&gl->gl_lockref.lock)
733722
goto skip_inval;
734723
}
735724

736-
if (test_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags)) {
725+
if (target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) {
737726
/*
738727
* The call to go_sync should have cleared out the ail list.
739728
* If there are still items, we have a problem. We ought to
@@ -748,7 +737,6 @@ __acquires(&gl->gl_lockref.lock)
748737
gfs2_dump_glock(NULL, gl, true);
749738
}
750739
glops->go_inval(gl, target == LM_ST_DEFERRED ? 0 : DIO_METADATA);
751-
clear_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags);
752740
}
753741
spin_lock(&gl->gl_lockref.lock);
754742

@@ -2314,8 +2302,6 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
23142302
*p++ = 'y';
23152303
if (test_bit(GLF_LFLUSH, gflags))
23162304
*p++ = 'f';
2317-
if (test_bit(GLF_INVALIDATE_IN_PROGRESS, gflags))
2318-
*p++ = 'i';
23192305
if (test_bit(GLF_PENDING_REPLY, gflags))
23202306
*p++ = 'R';
23212307
if (test_bit(GLF_HAVE_REPLY, gflags))

fs/gfs2/incore.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ enum {
319319
GLF_DEMOTE_IN_PROGRESS = 5,
320320
GLF_DIRTY = 6,
321321
GLF_LFLUSH = 7,
322-
GLF_INVALIDATE_IN_PROGRESS = 8,
323322
GLF_HAVE_REPLY = 9,
324323
GLF_INITIAL = 10,
325324
GLF_HAVE_FROZEN_REPLY = 11,

fs/gfs2/trace_gfs2.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
{(1UL << GLF_DEMOTE_IN_PROGRESS), "p" }, \
5353
{(1UL << GLF_DIRTY), "y" }, \
5454
{(1UL << GLF_LFLUSH), "f" }, \
55-
{(1UL << GLF_INVALIDATE_IN_PROGRESS), "i" }, \
5655
{(1UL << GLF_PENDING_REPLY), "R" }, \
5756
{(1UL << GLF_HAVE_REPLY), "r" }, \
5857
{(1UL << GLF_INITIAL), "a" }, \

0 commit comments

Comments
 (0)