All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: david@fromorbit.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH] xfs: unset MS_ACTIVE if mount fails
Date: Mon, 17 Oct 2016 18:10:51 -0700	[thread overview]
Message-ID: <20161018011051.GB20337@birch.djwong.org> (raw)

As part of the inode block map intent log item recovery process, we had
to set the IRECOVERY flag to prevent an unlinked inode from being
truncated during the first iput call.  This required us to set MS_ACTIVE
so that iput puts the inode on the lru instead of immediately evicting
the inode.

Unfortunately, if the mount fails later on, the inodes that have been
loaded (root dir and realtime) actually need to be evicted since we're
aborting the mount.  If we don't clear MS_ACTIVE in the failure step,
those inodes are not evicted and therefore leak.   The leak was found
by running xfs/130 and rmmoding xfs immediately after the test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_mount.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index fc78739..b341f10 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1009,6 +1009,7 @@ xfs_mountfs(
  out_quota:
 	xfs_qm_unmount_quotas(mp);
  out_rtunmount:
+	mp->m_super->s_flags &= ~MS_ACTIVE;
 	xfs_rtunmount_inodes(mp);
  out_rele_rip:
 	IRELE(rip);

             reply	other threads:[~2016-10-18  1:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18  1:10 Darrick J. Wong [this message]
2016-10-18  5:24 ` [PATCH] xfs: unset MS_ACTIVE if mount fails Christoph Hellwig
2016-10-18  5:38   ` Darrick J. Wong
2016-10-18  6:50     ` Christoph Hellwig

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=20161018011051.GB20337@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=david@fromorbit.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.