From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH 06/12] gfs2: Create transaction for inodes with i_nlink != 0
Date: Fri, 21 Aug 2020 12:33:31 -0500 [thread overview]
Message-ID: <20200821173337.20377-7-rpeterso@redhat.com> (raw)
In-Reply-To: <20200821173337.20377-1-rpeterso@redhat.com>
Before this patch, function gfs2_evict_inode would check if i_nlink
was non-zero, and if so, go to label out. The problem is, the evicted
file may still have outstanding pages that need invalidating, but
the call to truncate_inode_pages_final at label out doesn't start a
transaction. It needs a transaction in order to write revokes for any
pages it has to invalidate.
This patch removes the early check for i_nlink in gfs2_evict_inode.
Not much further down in the code, there's another check for i_nlink
that skips to out_truncate. That one is proper because the calls
to truncate_inode_pages after out_truncate use a proper transaction,
so the page invalidates and subsequent revokes may be done properly.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
fs/gfs2/super.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 80ac446f0110..1f3dee740431 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1344,7 +1344,7 @@ static void gfs2_evict_inode(struct inode *inode)
return;
}
- if (inode->i_nlink || sb_rdonly(sb))
+ if (sb_rdonly(sb))
goto out;
if (test_bit(GIF_ALLOC_FAILED, &ip->i_flags)) {
@@ -1370,15 +1370,19 @@ static void gfs2_evict_inode(struct inode *inode)
}
if (gfs2_inode_already_deleted(ip->i_gl, ip->i_no_formal_ino))
- goto out_truncate;
+ goto out_flush;
error = gfs2_check_blk_type(sdp, ip->i_no_addr, GFS2_BLKST_UNLINKED);
- if (error)
- goto out_truncate;
+ if (error) {
+ error = 0;
+ goto out_flush;
+ }
if (test_bit(GIF_INVALID, &ip->i_flags)) {
error = gfs2_inode_refresh(ip);
- if (error)
- goto out_truncate;
+ if (error) {
+ error = 0;
+ goto out_flush;
+ }
}
/*
@@ -1392,7 +1396,7 @@ static void gfs2_evict_inode(struct inode *inode)
test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags)) {
if (!gfs2_upgrade_iopen_glock(inode)) {
gfs2_holder_uninit(&ip->i_iopen_gh);
- goto out_truncate;
+ goto out_flush;
}
}
@@ -1424,7 +1428,7 @@ static void gfs2_evict_inode(struct inode *inode)
gfs2_inode_remember_delete(ip->i_gl, ip->i_no_formal_ino);
goto out_unlock;
-out_truncate:
+out_flush:
gfs2_log_flush(sdp, ip->i_gl, GFS2_LOG_HEAD_FLUSH_NORMAL |
GFS2_LFC_EVICT_INODE);
metamapping = gfs2_glock2aspace(ip->i_gl);
@@ -1435,6 +1439,7 @@ static void gfs2_evict_inode(struct inode *inode)
write_inode_now(inode, 1);
gfs2_ail_flush(ip->i_gl, 0);
+out_truncate:
nr_revokes = inode->i_mapping->nrpages + metamapping->nrpages;
if (!nr_revokes)
goto out_unlock;
--
2.26.2
next prev parent reply other threads:[~2020-08-21 17:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 17:33 [Cluster-devel] [GFS2 PATCH 00/12] gfs2: jdata patch collection revisited Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 01/12] gfs2: rename gfs2_write_full_page to gfs2_write_jdata_page, remove parm Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 02/12] gfs2: add missing log_blocks trace points in gfs2_write_revokes Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 03/12] gfs2: enhance log_blocks trace point to show log blocks free Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 04/12] gfs2: Wipe jdata and ail1 in gfs2_journal_wipe, formerly gfs2_meta_wipe Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 05/12] gfs2: Calculate number of revokes during evict Bob Peterson
2020-08-27 6:00 ` Andreas Gruenbacher
2020-08-21 17:33 ` Bob Peterson [this message]
2020-08-27 6:00 ` [Cluster-devel] [GFS2 PATCH 06/12] gfs2: Create transaction for inodes with i_nlink != 0 Andreas Gruenbacher
2020-08-27 7:41 ` Steven Whitehouse
2020-08-27 13:00 ` Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 07/12] gfs2: make gfs2_ail1_empty_one return the count of active items Bob Peterson
2020-08-27 6:00 ` Andreas Gruenbacher
2020-08-27 16:45 ` Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 08/12] gfs2: don't lock sd_ail_lock in gfs2_releasepage Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 09/12] gfs2: Only set PageChecked if we have a transaction Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 10/12] gfs2: simplify gfs2_block_map Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 11/12] gfs2: Ignore journal log writes for jdata holes Bob Peterson
2020-08-21 17:33 ` [Cluster-devel] [GFS2 PATCH 12/12] gfs2: add some much needed cleanup for log flushes that fail Bob Peterson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200821173337.20377-7-rpeterso@redhat.com \
--to=rpeterso@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).