Commit 35b6f8fb authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Wake up when setting GLF_DEMOTE

Wake up the sdp->sd_async_glock_wait wait queue when setting the GLF_DEMOTE
flag.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent b0dcffd8
...@@ -464,6 +464,15 @@ static void state_change(struct gfs2_glock *gl, unsigned int new_state) ...@@ -464,6 +464,15 @@ static void state_change(struct gfs2_glock *gl, unsigned int new_state)
gl->gl_tchange = jiffies; gl->gl_tchange = jiffies;
} }
static void gfs2_set_demote(struct gfs2_glock *gl)
{
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
set_bit(GLF_DEMOTE, &gl->gl_flags);
smp_mb();
wake_up(&sdp->sd_async_glock_wait);
}
static void gfs2_demote_wake(struct gfs2_glock *gl) static void gfs2_demote_wake(struct gfs2_glock *gl)
{ {
gl->gl_demote_state = LM_ST_EXCLUSIVE; gl->gl_demote_state = LM_ST_EXCLUSIVE;
...@@ -876,7 +885,7 @@ static void glock_work_func(struct work_struct *work) ...@@ -876,7 +885,7 @@ static void glock_work_func(struct work_struct *work)
if (!delay) { if (!delay) {
clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags); clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags);
set_bit(GLF_DEMOTE, &gl->gl_flags); gfs2_set_demote(gl);
} }
} }
run_queue(gl, 0); run_queue(gl, 0);
...@@ -1221,9 +1230,10 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs) ...@@ -1221,9 +1230,10 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs)
static void handle_callback(struct gfs2_glock *gl, unsigned int state, static void handle_callback(struct gfs2_glock *gl, unsigned int state,
unsigned long delay, bool remote) unsigned long delay, bool remote)
{ {
int bit = delay ? GLF_PENDING_DEMOTE : GLF_DEMOTE; if (delay)
set_bit(GLF_PENDING_DEMOTE, &gl->gl_flags);
set_bit(bit, &gl->gl_flags); else
gfs2_set_demote(gl);
if (gl->gl_demote_state == LM_ST_EXCLUSIVE) { if (gl->gl_demote_state == LM_ST_EXCLUSIVE) {
gl->gl_demote_state = state; gl->gl_demote_state = state;
gl->gl_demote_time = jiffies; gl->gl_demote_time = jiffies;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment