* [Cluster-devel] [GFS2 PATCH] Handle multiple glock demote requests
@ 2007-10-04 18:04 Wendy Cheng
2007-10-04 21:34 ` Josef Bacik
0 siblings, 1 reply; 4+ messages in thread
From: Wendy Cheng @ 2007-10-04 18:04 UTC (permalink / raw)
To: cluster-devel.redhat.com
Red Hat bugzilla 295641... Wendy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gfs2_waiters2.patch
Type: text/x-patch
Size: 2461 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20071004/eaf33e56/attachment.bin>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] [GFS2 PATCH] Handle multiple glock demote requests
2007-10-04 18:04 [Cluster-devel] [GFS2 PATCH] Handle multiple glock demote requests Wendy Cheng
@ 2007-10-04 21:34 ` Josef Bacik
2007-10-04 21:48 ` Wendy Cheng
0 siblings, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2007-10-04 21:34 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Thu, Oct 04, 2007 at 02:04:25PM -0400, Wendy Cheng wrote:
> Red Hat bugzilla 295641... Wendy
>
>
>
> Fix a race condition where multiple glock demote requests are sent to
> a node back-to-back. This patch does a check inside handle_callback()
> to see whether a demote request is in progress. If true, it sets a flag
> to make sure run_queue() will loop again to handle the new request,
> instead of erroneously setting gl_demote_state to a different state.
>
> Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
>
> glock.c | 13 ++++++++++++-
> incore.h | 2 ++
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> --- e48-brew/fs/gfs2/incore.h 2007-09-20 17:29:00.000000000 -0500
> +++ e48/fs/gfs2/incore.h 2007-10-02 16:45:38.000000000 -0500
> @@ -171,6 +171,7 @@ enum {
> GLF_DEMOTE = 3,
> GLF_PENDING_DEMOTE = 4,
> GLF_DIRTY = 5,
> + GLF_DEMOTE_IN_PROGRESS = 6,
> };
>
> struct gfs2_glock {
> @@ -190,6 +191,7 @@ struct gfs2_glock {
> struct list_head gl_holders;
> struct list_head gl_waiters1; /* HIF_MUTEX */
> struct list_head gl_waiters3; /* HIF_PROMOTE */
> + int gl_waiters2; /* GIF_DEMOTE */
>
> const struct gfs2_glock_operations *gl_ops;
>
> --- e48-brew/fs/gfs2/glock.c 2007-09-18 11:26:53.000000000 -0500
> +++ e48/fs/gfs2/glock.c 2007-10-02 18:19:12.000000000 -0500
> @@ -567,6 +567,7 @@ static int rq_demote(struct gfs2_glock *
> return 0;
> }
> set_bit(GLF_LOCK, &gl->gl_flags);
> + set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
> if (gl->gl_demote_state == LM_ST_UNLOCKED ||
> gl->gl_state != LM_ST_EXCLUSIVE) {
> spin_unlock(&gl->gl_spin);
> @@ -575,6 +576,8 @@ static int rq_demote(struct gfs2_glock *
> spin_unlock(&gl->gl_spin);
> gfs2_glock_xmote_th(gl, NULL);
> }
> +
> + clear_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
> spin_lock(&gl->gl_spin);
>
May want to move the clear_bit inside the spin_lock so you don't end up having
the same race where we clear the bit while inside handle_callback.
Josef
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] [GFS2 PATCH] Handle multiple glock demote requests
2007-10-04 21:34 ` Josef Bacik
@ 2007-10-04 21:48 ` Wendy Cheng
2007-10-05 4:27 ` Wendy Cheng
0 siblings, 1 reply; 4+ messages in thread
From: Wendy Cheng @ 2007-10-04 21:48 UTC (permalink / raw)
To: cluster-devel.redhat.com
Josef Bacik wrote:
>> set_bit(GLF_LOCK, &gl->gl_flags);
>> + set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
>> if (gl->gl_demote_state == LM_ST_UNLOCKED ||
>> gl->gl_state != LM_ST_EXCLUSIVE) {
>> spin_unlock(&gl->gl_spin);
>> @@ -575,6 +576,8 @@ static int rq_demote(struct gfs2_glock *
>> spin_unlock(&gl->gl_spin);
>> gfs2_glock_xmote_th(gl, NULL);
>> }
>> +
>> + clear_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
>> spin_lock(&gl->gl_spin);
>>
>>
>
> May want to move the clear_bit inside the spin_lock so you don't end up having
> the same race where we clear the bit while inside handle_callback.
>
>
Yep... good point .... Will make changes .. Wendy
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] [GFS2 PATCH] Handle multiple glock demote requests
2007-10-04 21:48 ` Wendy Cheng
@ 2007-10-05 4:27 ` Wendy Cheng
0 siblings, 0 replies; 4+ messages in thread
From: Wendy Cheng @ 2007-10-05 4:27 UTC (permalink / raw)
To: cluster-devel.redhat.com
Make a correction based on Josef's comment .... Wendy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gfs2_waiters2.patch
Type: text/x-patch
Size: 2495 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20071005/3fb11f92/attachment.bin>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-05 4:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-04 18:04 [Cluster-devel] [GFS2 PATCH] Handle multiple glock demote requests Wendy Cheng
2007-10-04 21:34 ` Josef Bacik
2007-10-04 21:48 ` Wendy Cheng
2007-10-05 4:27 ` Wendy Cheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).