From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH v2 10/12] xfs: clean up root inode properly on mount failure
Date: Fri, 7 Aug 2015 17:15:26 -0400 [thread overview]
Message-ID: <1438982128-38618-11-git-send-email-bfoster@redhat.com> (raw)
In-Reply-To: <1438982128-38618-1-git-send-email-bfoster@redhat.com>
The root inode is read as part of the xfs_mountfs() sequence and the
reference is dropped in the event of failure after we grab the inode.
The reference drop doesn't necessarily free the inode, however. It marks
it for reclaim and potentially kicks off the reclaim workqueue. The
workqueue is destroyed further up the error path, which means we are
subject to crash if the workqueue job runs after this point or a memory
leak which is identified if the xfs_inode_zone is destroyed (e.g., on
module removal). Both of these outcomes are reproducible via manual
instrumentation of a mount error after the root inode xfs_iget() call in
xfs_mountfs().
Update the xfs_mountfs() error path to cancel any potential reclaim work
items and to run a synchronous inode reclaim if the root inode is marked
for reclaim. This ensures that no jobs remain on the queue before it is
destroyed and that the root inode is freed before the reclaim mechanism
is torn down.
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
fs/xfs/xfs_mount.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 4825a8a..bf92e0c 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -957,6 +957,8 @@ xfs_mountfs(
xfs_rtunmount_inodes(mp);
out_rele_rip:
IRELE(rip);
+ cancel_delayed_work_sync(&mp->m_reclaim_work);
+ xfs_reclaim_inodes(mp, SYNC_WAIT);
out_log_dealloc:
xfs_log_mount_cancel(mp);
out_fail_wait:
--
2.1.0
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-08-07 21:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-07 21:15 [PATCH v2 00/12] xfs: miscellaneous logging, recovery, umount fixes Brian Foster
2015-08-07 21:15 ` [PATCH v2 01/12] xfs: disentagle EFI release from the extent count Brian Foster
2015-08-07 21:15 ` [PATCH v2 02/12] xfs: return committed status from xfs_trans_roll() Brian Foster
2015-08-07 21:15 ` [PATCH v2 03/12] xfs: fix efi/efd error handling to avoid fs shutdown hangs Brian Foster
2015-08-07 21:15 ` [PATCH v2 04/12] xfs: ensure EFD trans aborts on log recovery extent free failure Brian Foster
2015-08-07 21:15 ` [PATCH v2 05/12] xfs: use EFI refcount consistently in log recovery Brian Foster
2015-08-07 21:15 ` [PATCH v2 06/12] xfs: don't leave EFIs on AIL on mount failure Brian Foster
2015-08-07 21:15 ` [PATCH v2 07/12] xfs: icreate log item recovery and cancellation tracepoints Brian Foster
2015-08-07 21:15 ` [PATCH v2 08/12] xfs: fix broken icreate log item cancellation Brian Foster
2015-08-07 21:15 ` [PATCH v2 09/12] xfs: checksum log record ext headers based on record size Brian Foster
2015-08-07 21:15 ` Brian Foster [this message]
2015-08-07 21:15 ` [PATCH v2 11/12] xfs: fix btree cursor error cleanups Brian Foster
2015-08-07 21:15 ` [PATCH v2 12/12] xfs: add helper to conditionally remove items from the AIL Brian Foster
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=1438982128-38618-11-git-send-email-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=xfs@oss.sgi.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