mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
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. Commitd99724c3c3describes 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:d99724c3c3("gfs2: Close timing window with GLF_INVALIDATE_IN_PROGRESS") Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Andrew Price <anprice@redhat.com>
This commit is contained in:
@@ -703,17 +703,6 @@ __acquires(&gl->gl_lockref.lock)
|
|||||||
|
|
||||||
GLOCK_BUG_ON(gl, gl->gl_state == target);
|
GLOCK_BUG_ON(gl, gl->gl_state == target);
|
||||||
GLOCK_BUG_ON(gl, gl->gl_state == gl->gl_target);
|
GLOCK_BUG_ON(gl, gl->gl_state == gl->gl_target);
|
||||||
if ((target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) &&
|
|
||||||
glops->go_inval) {
|
|
||||||
/*
|
|
||||||
* If another process is already doing the invalidate, let that
|
|
||||||
* finish first. The glock state machine will get back to this
|
|
||||||
* holder again later.
|
|
||||||
*/
|
|
||||||
if (test_and_set_bit(GLF_INVALIDATE_IN_PROGRESS,
|
|
||||||
&gl->gl_flags))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!glops->go_inval || !glops->go_sync)
|
if (!glops->go_inval || !glops->go_sync)
|
||||||
goto skip_inval;
|
goto skip_inval;
|
||||||
|
|
||||||
@@ -732,7 +721,7 @@ __acquires(&gl->gl_lockref.lock)
|
|||||||
goto skip_inval;
|
goto skip_inval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags)) {
|
if (target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) {
|
||||||
/*
|
/*
|
||||||
* The call to go_sync should have cleared out the ail list.
|
* The call to go_sync should have cleared out the ail list.
|
||||||
* If there are still items, we have a problem. We ought to
|
* If there are still items, we have a problem. We ought to
|
||||||
@@ -747,7 +736,6 @@ __acquires(&gl->gl_lockref.lock)
|
|||||||
gfs2_dump_glock(NULL, gl, true);
|
gfs2_dump_glock(NULL, gl, true);
|
||||||
}
|
}
|
||||||
glops->go_inval(gl, target == LM_ST_DEFERRED ? 0 : DIO_METADATA);
|
glops->go_inval(gl, target == LM_ST_DEFERRED ? 0 : DIO_METADATA);
|
||||||
clear_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags);
|
|
||||||
}
|
}
|
||||||
spin_lock(&gl->gl_lockref.lock);
|
spin_lock(&gl->gl_lockref.lock);
|
||||||
|
|
||||||
@@ -2316,8 +2304,6 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
|
|||||||
*p++ = 'y';
|
*p++ = 'y';
|
||||||
if (test_bit(GLF_LFLUSH, gflags))
|
if (test_bit(GLF_LFLUSH, gflags))
|
||||||
*p++ = 'f';
|
*p++ = 'f';
|
||||||
if (test_bit(GLF_INVALIDATE_IN_PROGRESS, gflags))
|
|
||||||
*p++ = 'i';
|
|
||||||
if (test_bit(GLF_PENDING_REPLY, gflags))
|
if (test_bit(GLF_PENDING_REPLY, gflags))
|
||||||
*p++ = 'R';
|
*p++ = 'R';
|
||||||
if (test_bit(GLF_HAVE_REPLY, gflags))
|
if (test_bit(GLF_HAVE_REPLY, gflags))
|
||||||
|
|||||||
@@ -319,7 +319,6 @@ enum {
|
|||||||
GLF_DEMOTE_IN_PROGRESS = 5,
|
GLF_DEMOTE_IN_PROGRESS = 5,
|
||||||
GLF_DIRTY = 6,
|
GLF_DIRTY = 6,
|
||||||
GLF_LFLUSH = 7,
|
GLF_LFLUSH = 7,
|
||||||
GLF_INVALIDATE_IN_PROGRESS = 8,
|
|
||||||
GLF_HAVE_REPLY = 9,
|
GLF_HAVE_REPLY = 9,
|
||||||
GLF_INITIAL = 10,
|
GLF_INITIAL = 10,
|
||||||
GLF_HAVE_FROZEN_REPLY = 11,
|
GLF_HAVE_FROZEN_REPLY = 11,
|
||||||
|
|||||||
@@ -52,7 +52,6 @@
|
|||||||
{(1UL << GLF_DEMOTE_IN_PROGRESS), "p" }, \
|
{(1UL << GLF_DEMOTE_IN_PROGRESS), "p" }, \
|
||||||
{(1UL << GLF_DIRTY), "y" }, \
|
{(1UL << GLF_DIRTY), "y" }, \
|
||||||
{(1UL << GLF_LFLUSH), "f" }, \
|
{(1UL << GLF_LFLUSH), "f" }, \
|
||||||
{(1UL << GLF_INVALIDATE_IN_PROGRESS), "i" }, \
|
|
||||||
{(1UL << GLF_PENDING_REPLY), "R" }, \
|
{(1UL << GLF_PENDING_REPLY), "R" }, \
|
||||||
{(1UL << GLF_HAVE_REPLY), "r" }, \
|
{(1UL << GLF_HAVE_REPLY), "r" }, \
|
||||||
{(1UL << GLF_INITIAL), "a" }, \
|
{(1UL << GLF_INITIAL), "a" }, \
|
||||||
|
|||||||
Reference in New Issue
Block a user