Commit a6a4d98b0124b5d3befe8b3a99f51f1b4fcc6dcf

Authored by Bob Peterson
Committed by Steven Whitehouse
1 parent e8830d8856

GFS2: Don't cache iopen glocks

This patch makes GFS2 immediately reclaim/delete all iopen glocks
as soon as they're dequeued. This allows deleters to get an
EXclusive lock on iopen so files are deleted properly instead of
being set as unlinked.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

Showing 2 changed files with 6 additions and 1 deletions Side-by-side Diff

... ... @@ -189,6 +189,7 @@
189 189 return inode;
190 190  
191 191 fail_refresh:
  192 + ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
192 193 ip->i_iopen_gh.gh_gl->gl_object = NULL;
193 194 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
194 195 fail_iopen:
... ... @@ -1444,6 +1444,7 @@
1444 1444 /* Must not read inode block until block type has been verified */
1445 1445 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, &gh);
1446 1446 if (unlikely(error)) {
  1447 + ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
1447 1448 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
1448 1449 goto out;
1449 1450 }
1450 1451  
... ... @@ -1514,8 +1515,10 @@
1514 1515 if (gfs2_rs_active(ip->i_res))
1515 1516 gfs2_rs_deltree(ip->i_res);
1516 1517  
1517   - if (test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags))
  1518 + if (test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags)) {
  1519 + ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
1518 1520 gfs2_glock_dq(&ip->i_iopen_gh);
  1521 + }
1519 1522 gfs2_holder_uninit(&ip->i_iopen_gh);
1520 1523 gfs2_glock_dq_uninit(&gh);
1521 1524 if (error && error != GLR_TRYFAILED && error != -EROFS)
... ... @@ -1534,6 +1537,7 @@
1534 1537 ip->i_gl = NULL;
1535 1538 if (ip->i_iopen_gh.gh_gl) {
1536 1539 ip->i_iopen_gh.gh_gl->gl_object = NULL;
  1540 + ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
1537 1541 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
1538 1542 }
1539 1543 }