From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH 2/3] xfs: don't leak linked inodes during log recovery
Date: Tue, 8 Aug 2017 18:06:50 -0700 [thread overview]
Message-ID: <20170809010650.GF4474@magnolia> (raw)
In-Reply-To: <20170809010444.GR24087@magnolia>
When we introduced the bmap redo log items, we set MS_ACTIVE on the
mountpoint and XFS_IRECOVERY on the inode to prevent unlinked inodes
from being truncated prematurely during log recovery. However, we
neglected to drop linked inodes that are recovered, and if we don't use
the inode between recovery and unmount, the inode will never be marked
reclaimable and thus we fail to free it at umount time. If we're in
log recovery but IRECOVERY is /not/ set, the inode is linked and can be
reclaimed.
Fixes: 17c12bcd30 ("xfs: when replaying bmap operations, don't let unlinked inodes get reaped")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/xfs_super.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 38aaacd..9b06ca2 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1040,6 +1040,13 @@ xfs_fs_drop_inode(
if (ip->i_flags & XFS_IRECOVERY) {
ASSERT(ip->i_mount->m_log->l_flags & XLOG_RECOVERY_NEEDED);
return 0;
+ } else if (ip->i_mount->m_log->l_flags & XLOG_RECOVERY_NEEDED) {
+ /*
+ * This inode was loaded during recovery but is not
+ * being unlinked, so we can free it without fear of
+ * premature truncation.
+ */
+ return 1;
}
return generic_drop_inode(inode) || (ip->i_flags & XFS_IDONTCACHE);
next prev parent reply other threads:[~2017-08-09 1:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-09 1:04 [PATCH 1/3] xfs: clear MS_ACTIVE after finishing log recovery to avoid inode leak Darrick J. Wong
2017-08-09 1:06 ` Darrick J. Wong [this message]
2017-08-09 12:36 ` [PATCH 2/3] xfs: don't leak linked inodes during log recovery Brian Foster
2017-08-09 16:49 ` Darrick J. Wong
2017-08-09 17:17 ` Brian Foster
2017-08-09 1:07 ` [PATCH 3/3] xfs: don't leak quotacheck dquots when cow recovery fails Darrick J. Wong
2017-08-09 12:36 ` Brian Foster
2017-08-09 16:06 ` Darrick J. Wong
2017-08-09 6:31 ` [PATCH 1/3] xfs: clear MS_ACTIVE after finishing log recovery to avoid inode leak Nikolay Borisov
2017-08-09 12:36 ` Brian Foster
2017-08-09 15:46 ` Darrick J. Wong
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=20170809010650.GF4474@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/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