From: Steven Whitehouse <swhiteho@redhat.com> Date: Tue, 12 Feb 2008 17:07:13 +0000 Subject: [gfs2] fix calling of drop_bh Message-id: 1202836033.22038.446.camel@quoit O-Subject: [RHEL 5.2] bz #423370 Fix calling of drop_bh Bugzilla: 432370 Hi, Here is the patch from upstream. Its been tested and shown to fix bz #423370. This one is fairly urgent since its holding up testing, Steve. ------------------------------------------------------------------------------------ >From c3938ce043464e99b813be64929b15da03bd7417 Mon Sep 17 00:00:00 2001 From: Steven Whitehouse <swhiteho@redhat.com> Date: Tue, 12 Feb 2008 15:28:21 +0000 Subject: [PATCH 4/4] [GFS2] Fix bug where we called drop_bh incorrectly As a result of an earlier patch, drop_bh was being called in cases when it shouldn't have been. Since we never have a gh in the drop case and we always have a gh in the promote case, we can use that extra information to tell which case has been seen. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Cc: Bob Peterson <rpeterso@redhat.com> Acked-by: Bob Peterson <rpeterso@redhat.com> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 515b241..89110f0 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -767,7 +767,6 @@ static void drop_bh(struct gfs2_glock *gl, unsigned int ret) { struct gfs2_sbd *sdp = gl->gl_sbd; const struct gfs2_glock_operations *glops = gl->gl_ops; - struct gfs2_holder *gh = gl->gl_req_gh; gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); gfs2_assert_warn(sdp, list_empty(&gl->gl_holders)); @@ -778,23 +777,11 @@ static void drop_bh(struct gfs2_glock *gl, unsigned int ret) if (glops->go_inval) glops->go_inval(gl, DIO_METADATA); - if (gh) { - spin_lock(&gl->gl_spin); - list_del_init(&gh->gh_list); - gh->gh_error = 0; - spin_unlock(&gl->gl_spin); - } - spin_lock(&gl->gl_spin); gfs2_demote_wake(gl); - gl->gl_req_gh = NULL; clear_bit(GLF_LOCK, &gl->gl_flags); spin_unlock(&gl->gl_spin); - gfs2_glock_put(gl); - - if (gh) - gfs2_holder_wake(gh); } /** @@ -812,7 +799,7 @@ static void xmote_bh(struct gfs2_glock *gl, unsigned int ret) int prev_state = gl->gl_state; int op_done = 1; - if ((ret & LM_OUT_ST_MASK) == LM_ST_UNLOCKED) { + if (!gh && (ret & LM_OUT_ST_MASK) == LM_ST_UNLOCKED) { drop_bh(gl, ret); return; }