Skip to content

Commit 0baa10b

Browse files
author
Andreas Gruenbacher
committed
gfs2: Clean up delete work processing
Function delete_work_func() was previously assuming that the GLF_TRY_TO_EVICT and GLF_VERIFY_DELETE flags won't both be set at the same time, but there probably are races in which that can happen, so handle that case correctly. Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent b410045 commit 0baa10b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/gfs2/glock.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,7 @@ static void delete_work_func(struct work_struct *work)
10281028
struct delayed_work *dwork = to_delayed_work(work);
10291029
struct gfs2_glock *gl = container_of(dwork, struct gfs2_glock, gl_delete);
10301030
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
1031+
bool verify_delete = test_and_clear_bit(GLF_VERIFY_DELETE, &gl->gl_flags);
10311032

10321033
if (test_and_clear_bit(GLF_TRY_TO_EVICT, &gl->gl_flags)) {
10331034
/*
@@ -1048,15 +1049,15 @@ static void delete_work_func(struct work_struct *work)
10481049
* step entirely.
10491050
*/
10501051
if (gfs2_try_evict(gl)) {
1051-
if (test_bit(SDF_KILL, &sdp->sd_flags))
1052-
goto out;
1053-
if (gfs2_queue_verify_delete(gl, true))
1054-
return;
1052+
if (!test_bit(SDF_KILL, &sdp->sd_flags)) {
1053+
gfs2_glock_hold(gl);
1054+
if (!gfs2_queue_verify_delete(gl, true))
1055+
gfs2_glock_put(gl);
1056+
}
10551057
}
1056-
goto out;
10571058
}
10581059

1059-
if (test_and_clear_bit(GLF_VERIFY_DELETE, &gl->gl_flags)) {
1060+
if (verify_delete) {
10601061
u64 no_addr = gl->gl_name.ln_number;
10611062
struct inode *inode;
10621063

@@ -1073,7 +1074,6 @@ static void delete_work_func(struct work_struct *work)
10731074
}
10741075
}
10751076

1076-
out:
10771077
gfs2_glock_put(gl);
10781078
}
10791079

0 commit comments

Comments
 (0)