Skip to content

Commit bddb53b

Browse files
author
Andreas Gruenbacher
committed
gfs2: Get rid of GLF_INVALIDATE_IN_PROGRESS
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> Reviewed-by: Andrew Price <anprice@redhat.com>
1 parent 061df28 commit bddb53b

3 files changed

Lines changed: 1 addition & 17 deletions

File tree

fs/gfs2/glock.c

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

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

@@ -732,7 +721,7 @@ __acquires(&gl->gl_lockref.lock)
732721
goto skip_inval;
733722
}
734723

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

@@ -2316,8 +2304,6 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
23162304
*p++ = 'y';
23172305
if (test_bit(GLF_LFLUSH, gflags))
23182306
*p++ = 'f';
2319-
if (test_bit(GLF_INVALIDATE_IN_PROGRESS, gflags))
2320-
*p++ = 'i';
23212307
if (test_bit(GLF_PENDING_REPLY, gflags))
23222308
*p++ = 'R';
23232309
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)