Skip to content

Commit c688b8b

Browse files
AstralBobswhiteho
authored andcommitted
GFS2: Add non-try locks back to get_local_rgrp
This upstream patch had what I believe is an unintended consequence: http://git.kernel.org/?p=linux/kernel/git/steve/gfs2-3.0-nmw.git;a=commitdiff;h=beca42486749c1538a5ed58fe9dcc9f26d428c93 The patch changed function get_local_rgrp such that it ONLY used TRY locks for RGRP searches. Prior to that patch, the code used TRY locks during the first loop, and if that was unsuccessful, it used normal blocking locks on subsequent searches. This patch changes it back to the old way. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
1 parent 79c4c37 commit c688b8b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎fs/gfs2/rgrp.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ static int get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked)
978978
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
979979
struct gfs2_rgrpd *rgd, *begin = NULL;
980980
struct gfs2_alloc *al = ip->i_alloc;
981-
int error, rg_locked;
981+
int error, rg_locked, flags = LM_FLAG_TRY;
982982
int loops = 0;
983983

984984
if (ip->i_rgd && rgrp_contains_block(ip->i_rgd, ip->i_goal))
@@ -997,7 +997,7 @@ static int get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked)
997997
error = 0;
998998
} else {
999999
error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE,
1000-
LM_FLAG_TRY, &al->al_rgd_gh);
1000+
flags, &al->al_rgd_gh);
10011001
}
10021002
switch (error) {
10031003
case 0:
@@ -1012,8 +1012,10 @@ static int get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked)
10121012
/* fall through */
10131013
case GLR_TRYFAILED:
10141014
rgd = gfs2_rgrpd_get_next(rgd);
1015-
if (rgd == begin)
1015+
if (rgd == begin) {
1016+
flags = 0;
10161017
loops++;
1018+
}
10171019
break;
10181020
default:
10191021
return error;

0 commit comments

Comments
 (0)