summaryrefslogtreecommitdiff
path: root/fs/gfs2
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2024-09-13 01:17:40 +0200
committerAndreas Gruenbacher <agruenba@redhat.com>2024-11-05 12:39:28 +0100
commita94dafe87d5fdded799fc25b82b123fb93959421 (patch)
tree8e63658e2a2659f3a9de7c8f476e1018174e580b /fs/gfs2
parentc79ba4be351a06e0ac4c51143a83023bb37888d6 (diff)
downloadlinux-a94dafe87d5fdded799fc25b82b123fb93959421.tar.gz
linux-a94dafe87d5fdded799fc25b82b123fb93959421.tar.bz2
linux-a94dafe87d5fdded799fc25b82b123fb93959421.zip
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 <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/super.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index f43b238ccaf1..46d325c2ab88 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1257,7 +1257,7 @@ static void gfs2_glock_put_eventually(struct gfs2_glock *gl)
gfs2_glock_put(gl);
}
-static bool gfs2_upgrade_iopen_glock(struct inode *inode)
+static enum evict_behavior gfs2_upgrade_iopen_glock(struct inode *inode)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode);
@@ -1290,7 +1290,7 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode)
gfs2_holder_reinit(LM_ST_EXCLUSIVE, GL_ASYNC | GL_NOCACHE, gh);
error = gfs2_glock_nq(gh);
if (error)
- return false;
+ return EVICT_SHOULD_SKIP_DELETE;
wait_event_interruptible_timeout(sdp->sd_async_glock_wait,
!test_bit(HIF_WAIT, &gh->gh_iflags) ||
@@ -1298,9 +1298,14 @@ static bool gfs2_upgrade_iopen_glock(struct inode *inode)
5 * HZ);
if (!test_bit(HIF_HOLDER, &gh->gh_iflags)) {
gfs2_glock_dq(gh);
- return false;
+ if (glock_needs_demote(ip->i_gl))
+ return EVICT_SHOULD_SKIP_DELETE;
+ return EVICT_SHOULD_DEFER_DELETE;
}
- return gfs2_glock_holder_ready(gh) == 0;
+ error = gfs2_glock_holder_ready(gh);
+ if (error)
+ return EVICT_SHOULD_SKIP_DELETE;
+ return EVICT_SHOULD_DELETE;
}
/**
@@ -1359,9 +1364,12 @@ static enum evict_behavior evict_should_delete(struct inode *inode,
should_delete:
if (gfs2_holder_initialized(&ip->i_iopen_gh) &&
test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags)) {
- if (!gfs2_upgrade_iopen_glock(inode)) {
+ enum evict_behavior behavior =
+ gfs2_upgrade_iopen_glock(inode);
+
+ if (behavior != EVICT_SHOULD_DELETE) {
gfs2_holder_uninit(&ip->i_iopen_gh);
- return EVICT_SHOULD_SKIP_DELETE;
+ return behavior;
}
}
return EVICT_SHOULD_DELETE;