Skip to content

Commit 3774f53

Browse files
author
Andreas Gruenbacher
committed
gfs2: Replace GIF_DEFER_DELETE with GLF_DEFER_DELETE
Having this flag attached to the iopen glock instead of the inode is much simpler; it eliminates a protential weird race in gfs2_try_evict(). Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent f83f897 commit 3774f53

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

fs/gfs2/glock.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,15 +991,15 @@ static void gfs2_try_evict(struct gfs2_glock *gl)
991991
}
992992
}
993993
if (ip) {
994-
set_bit(GIF_DEFER_DELETE, &ip->i_flags);
994+
set_bit(GLF_DEFER_DELETE, &gl->gl_flags);
995995
d_prune_aliases(&ip->i_inode);
996996
iput(&ip->i_inode);
997+
clear_bit(GLF_DEFER_DELETE, &gl->gl_flags);
997998

998999
/* If the inode was evicted, gl->gl_object will now be NULL. */
9991000
spin_lock(&gl->gl_lockref.lock);
10001001
ip = gl->gl_object;
10011002
if (ip) {
1002-
clear_bit(GIF_DEFER_DELETE, &ip->i_flags);
10031003
if (!igrab(&ip->i_inode))
10041004
ip = NULL;
10051005
}
@@ -2350,6 +2350,8 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
23502350
*p++ = 'e';
23512351
if (test_bit(GLF_VERIFY_DELETE, gflags))
23522352
*p++ = 'E';
2353+
if (test_bit(GLF_DEFER_DELETE, gflags))
2354+
*p++ = 's';
23532355
*p = 0;
23542356
return buf;
23552357
}

fs/gfs2/incore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ enum {
331331
GLF_TRY_TO_EVICT = 17, /* iopen glocks only */
332332
GLF_VERIFY_DELETE = 18, /* iopen glocks only */
333333
GLF_PENDING_REPLY = 19,
334+
GLF_DEFER_DELETE = 20, /* iopen glocks only */
334335
};
335336

336337
struct gfs2_glock {
@@ -377,7 +378,6 @@ enum {
377378
GIF_SW_PAGED = 3,
378379
GIF_FREE_VFS_INODE = 5,
379380
GIF_GLOP_PENDING = 6,
380-
GIF_DEFER_DELETE = 7,
381381
};
382382

383383
struct gfs2_inode {

fs/gfs2/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,8 @@ static enum evict_behavior evict_should_delete(struct inode *inode,
13291329
if (unlikely(test_bit(GIF_ALLOC_FAILED, &ip->i_flags)))
13301330
goto should_delete;
13311331

1332-
if (test_bit(GIF_DEFER_DELETE, &ip->i_flags))
1332+
if (gfs2_holder_initialized(&ip->i_iopen_gh) &&
1333+
test_bit(GLF_DEFER_DELETE, &ip->i_iopen_gh.gh_gl->gl_flags))
13331334
return EVICT_SHOULD_DEFER_DELETE;
13341335

13351336
/* Deletes should never happen under memory pressure anymore. */

fs/gfs2/trace_gfs2.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
{(1UL << GLF_INSTANTIATE_NEEDED), "n" }, \
6565
{(1UL << GLF_INSTANTIATE_IN_PROG), "N" }, \
6666
{(1UL << GLF_TRY_TO_EVICT), "e" }, \
67-
{(1UL << GLF_VERIFY_DELETE), "E" })
67+
{(1UL << GLF_VERIFY_DELETE), "E" }, \
68+
{(1UL << GLF_DEFER_DELETE), "s" })
6869

6970
#ifndef NUMPTY
7071
#define NUMPTY

0 commit comments

Comments
 (0)