Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 086d8334 authored by Benjamin Marzinski's avatar Benjamin Marzinski Committed by Steven Whitehouse
Browse files

GFS2: fix recursive locking during rindex truncates



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: default avatarBenjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 0489b3f5
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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;

	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,6 +883,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
out_rlist:
	gfs2_rlist_free(&rlist);
out:
	if (ip != GFS2_I(sdp->sd_rindex))
		gfs2_glock_dq_uninit(&ip->i_alloc->al_ri_gh);
	return error;
}
+1 −1
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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);