Skip to content

Commit a94dafe

Browse files
author
Andreas Gruenbacher
committed
gfs2: Return enum evict_behavior from gfs2_upgrade_iopen_glock
In case an iopen glock cannot be upgraded, function gfs2_upgrade_iopen_glock() needs to communicate to gfs2_evict_inode() whether deleting the inode should be deferred or skipped altogether. Change the function to return the appropriate enum evict_behavior value to indicate that. Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent c79ba4b commit a94dafe

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

fs/gfs2/super.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ static void gfs2_glock_put_eventually(struct gfs2_glock *gl)
12571257
gfs2_glock_put(gl);
12581258
}
12591259

1260-
static bool gfs2_upgrade_iopen_glock(struct inode *inode)
1260+
static enum evict_behavior gfs2_upgrade_iopen_glock(struct inode *inode)
12611261
{
12621262
struct gfs2_inode *ip = GFS2_I(inode);
12631263
struct gfs2_sbd *sdp = GFS2_SB(inode);
@@ -1290,17 +1290,22 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode)
12901290
gfs2_holder_reinit(LM_ST_EXCLUSIVE, GL_ASYNC | GL_NOCACHE, gh);
12911291
error = gfs2_glock_nq(gh);
12921292
if (error)
1293-
return false;
1293+
return EVICT_SHOULD_SKIP_DELETE;
12941294

12951295
wait_event_interruptible_timeout(sdp->sd_async_glock_wait,
12961296
!test_bit(HIF_WAIT, &gh->gh_iflags) ||
12971297
glock_needs_demote(ip->i_gl),
12981298
5 * HZ);
12991299
if (!test_bit(HIF_HOLDER, &gh->gh_iflags)) {
13001300
gfs2_glock_dq(gh);
1301-
return false;
1301+
if (glock_needs_demote(ip->i_gl))
1302+
return EVICT_SHOULD_SKIP_DELETE;
1303+
return EVICT_SHOULD_DEFER_DELETE;
13021304
}
1303-
return gfs2_glock_holder_ready(gh) == 0;
1305+
error = gfs2_glock_holder_ready(gh);
1306+
if (error)
1307+
return EVICT_SHOULD_SKIP_DELETE;
1308+
return EVICT_SHOULD_DELETE;
13041309
}
13051310

13061311
/**
@@ -1359,9 +1364,12 @@ static enum evict_behavior evict_should_delete(struct inode *inode,
13591364
should_delete:
13601365
if (gfs2_holder_initialized(&ip->i_iopen_gh) &&
13611366
test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags)) {
1362-
if (!gfs2_upgrade_iopen_glock(inode)) {
1367+
enum evict_behavior behavior =
1368+
gfs2_upgrade_iopen_glock(inode);
1369+
1370+
if (behavior != EVICT_SHOULD_DELETE) {
13631371
gfs2_holder_uninit(&ip->i_iopen_gh);
1364-
return EVICT_SHOULD_SKIP_DELETE;
1372+
return behavior;
13651373
}
13661374
}
13671375
return EVICT_SHOULD_DELETE;

0 commit comments

Comments
 (0)