cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 11/15] GFS2: fix recursive locking during rindex truncates
Date: Fri, 17 Dec 2010 12:24:17 +0000	[thread overview]
Message-ID: <1292588661-14350-12-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1292588661-14350-1-git-send-email-swhiteho@redhat.com>

From: Benjamin Marzinski <bmarzins@redhat.com>

When you truncate the rindex file, you need to avoid calling gfs2_rindex_hold,
since you already hold it.  However, if you haven't already read in the
resource groups, you need to do that.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 5476c06..ae7d205 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -780,7 +780,11 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
 	if (metadata)
 		revokes = (height) ? sdp->sd_inptrs : sdp->sd_diptrs;
 
-	error = gfs2_rindex_hold(sdp, &ip->i_alloc->al_ri_gh);
+	if (ip != GFS2_I(sdp->sd_rindex))
+		error = gfs2_rindex_hold(sdp, &ip->i_alloc->al_ri_gh);
+	else if (!sdp->sd_rgrps)
+		error = gfs2_ri_update(ip);
+
 	if (error)
 		return error;
 
@@ -879,7 +883,8 @@ out_rg_gunlock:
 out_rlist:
 	gfs2_rlist_free(&rlist);
 out:
-	gfs2_glock_dq_uninit(&ip->i_alloc->al_ri_gh);
+	if (ip != GFS2_I(sdp->sd_rindex))
+		gfs2_glock_dq_uninit(&ip->i_alloc->al_ri_gh);
 	return error;
 }
 
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 6375b38..25dbe5c 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -583,7 +583,7 @@ static int read_rindex_entry(struct gfs2_inode *ip,
  * Returns: 0 on successful update, error code otherwise
  */
 
-static int gfs2_ri_update(struct gfs2_inode *ip)
+int gfs2_ri_update(struct gfs2_inode *ip)
 {
 	struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
 	struct inode *inode = &ip->i_inode;
diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h
index 0e35c04..50c2bb0 100644
--- a/fs/gfs2/rgrp.h
+++ b/fs/gfs2/rgrp.h
@@ -48,6 +48,7 @@ extern int gfs2_inplace_reserve_i(struct gfs2_inode *ip, int hold_rindex,
 
 extern void gfs2_inplace_release(struct gfs2_inode *ip);
 
+extern int gfs2_ri_update(struct gfs2_inode *ip);
 extern int gfs2_alloc_block(struct gfs2_inode *ip, u64 *bn, unsigned int *n);
 extern int gfs2_alloc_di(struct gfs2_inode *ip, u64 *bn, u64 *generation);
 
-- 
1.7.3.3



  parent reply	other threads:[~2010-12-17 12:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-17 12:24 [Cluster-devel] GFS2: Pre-pull patch posting (-nmw) Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 01/15] GFS2: Change two WQ_RESCUERs into WQ_MEM_RECLAIM Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 02/15] GFS2: fs/gfs2/glock.c: Convert sprintf_symbol to %pS Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 03/15] GFS2: Remove unreachable calls to vmtruncate Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 04/15] GFS2: Clean up duplicated setattr code Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 05/15] GFS2: fs/gfs2/glock.c: Use printf extension %pV Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 06/15] GFS2: fs/gfs2/glock.h: Add __attribute__((format(printf, 2, 3)) to gfs2_print_dbg Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 07/15] GFS2: Allow gfs2 to update quota usage values through the quotactl interface Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 08/15] GFS2: Clean up of gdlm_lock function Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 09/15] GFS2: Remove duplicate #defines from glock.h Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 10/15] GFS2: reread rindex when necessary to grow rindex Steven Whitehouse
2010-12-17 12:24 ` Steven Whitehouse [this message]
2010-12-17 12:24 ` [Cluster-devel] [PATCH 12/15] GFS2: Fix uninitialised error value in previous patch Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 13/15] GFS2: Merge glock state fields into a bitfield Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 14/15] GFS2: fsck.gfs2 reported statfs error after gfs2_grow Steven Whitehouse
2010-12-17 12:24 ` [Cluster-devel] [PATCH 15/15] GFS2: Don't flush delete workqueue when releasing the transaction lock Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1292588661-14350-12-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).