aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/rgrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r--fs/gfs2/rgrp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 981bfa32121a..49ada95209d0 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -683,16 +683,21 @@ int gfs2_rindex_update(struct gfs2_sbd *sdp)
683 struct gfs2_glock *gl = ip->i_gl; 683 struct gfs2_glock *gl = ip->i_gl;
684 struct gfs2_holder ri_gh; 684 struct gfs2_holder ri_gh;
685 int error = 0; 685 int error = 0;
686 int unlock_required = 0;
686 687
687 /* Read new copy from disk if we don't have the latest */ 688 /* Read new copy from disk if we don't have the latest */
688 if (!sdp->sd_rindex_uptodate) { 689 if (!sdp->sd_rindex_uptodate) {
689 mutex_lock(&sdp->sd_rindex_mutex); 690 mutex_lock(&sdp->sd_rindex_mutex);
690 error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &ri_gh); 691 if (!gfs2_glock_is_locked_by_me(gl)) {
691 if (error) 692 error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &ri_gh);
692 return error; 693 if (error)
694 return error;
695 unlock_required = 1;
696 }
693 if (!sdp->sd_rindex_uptodate) 697 if (!sdp->sd_rindex_uptodate)
694 error = gfs2_ri_update(ip); 698 error = gfs2_ri_update(ip);
695 gfs2_glock_dq_uninit(&ri_gh); 699 if (unlock_required)
700 gfs2_glock_dq_uninit(&ri_gh);
696 mutex_unlock(&sdp->sd_rindex_mutex); 701 mutex_unlock(&sdp->sd_rindex_mutex);
697 } 702 }
698 703