linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 7/5] xfs: on failed mount, force-reclaim inodes after unmounting quota controls
Date: Thu, 9 Nov 2017 15:49:28 -0800	[thread overview]
Message-ID: <20171109234928.GP26910@magnolia> (raw)
In-Reply-To: <20171109232425.GQ4094@dastard>

On Fri, Nov 10, 2017 at 10:24:25AM +1100, Dave Chinner wrote:
> On Wed, Nov 08, 2017 at 10:00:10PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > When mounting fails, we must force-reclaim inodes (and disable delayed
> > reclaim) /after/ the realtime and quota control have let go of the
> > realtime and quota inodes.  Without this, we corrupt the timer list and
> > cause other weird problems.
> > 
> > Found by xfs/376 fuzzing u3.bmbt[0].lastoff on an rmap filesystem to
> > force a bogus post-eof extent reclaim that causes the fs to go down.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  fs/xfs/xfs_mount.c |    9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> > index e9727d0..a9f0fe9 100644
> > --- a/fs/xfs/xfs_mount.c
> > +++ b/fs/xfs/xfs_mount.c
> > @@ -1022,10 +1022,15 @@ 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);
> >  	/* Clean out dquots that might be in memory after quotacheck. */
> >  	xfs_qm_unmount(mp);
> > +	/*
> > +	 * Cancel all delayed reclaim work and reclaim the inodes directly.
> > +	 * We have to do this /after/ rtunmount and qm_unmount because those
> > +	 * two will have scheduled delayed reclaim for the rt/quota inodes.
> > +	 */
> > +	cancel_delayed_work_sync(&mp->m_reclaim_work);
> > +	xfs_reclaim_inodes(mp, SYNC_WAIT);
> >   out_log_dealloc:
> >  	mp->m_flags |= XFS_MOUNT_UNMOUNTING;
> >  	xfs_log_mount_cancel(mp);
> 
> Same bug in xfs_unmountfs(), isn't there? Otherwise this needs
> explaining why the order is different to a normal unmount...

Slightly different circumstances here.  In the unmountfs path we're
guaranteed to have called xfs_qm_unmount_quotas (which will irele the
quota inodes) before we shut down inode reclaim, but in the mountfs
error-out paths we decide to bail out after xfs_qm_newmount but before
calling xfs_qm_mount_quotas (e.g.  log_mount_finish failure), which
means that xfs_qm_unmount is the only chance we have to clean out the
quota inodes.

--D

> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-11-09 23:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07  1:03 [PATCH 0/5] xfs: various 4.15 scrub fixes Darrick J. Wong
2017-11-07  1:03 ` [PATCH 1/5] xfs: check the uniqueness of the AGFL entries Darrick J. Wong
2017-11-09  2:08   ` Dave Chinner
2017-11-09  2:48     ` Darrick J. Wong
2017-11-09  5:02   ` [PATCH v2 " Darrick J. Wong
2017-11-09 22:12     ` Darrick J. Wong
2017-11-09 23:39   ` [PATCH v3 " Darrick J. Wong
2017-11-10  1:23     ` Dave Chinner
2017-11-07  1:03 ` [PATCH 2/5] xfs: refactor the directory data block bestfree checks Darrick J. Wong
2017-11-09  2:11   ` Dave Chinner
2017-11-07  1:03 ` [PATCH 3/5] xfs: pass inode number to xfs_scrub_ino_set_{preen, warning} Darrick J. Wong
2017-11-09  2:13   ` Dave Chinner
2017-11-07  1:03 ` [PATCH 4/5] xfs: fix uninitialized return values in scrub code Darrick J. Wong
2017-11-09  2:13   ` Dave Chinner
2017-11-07  1:03 ` [PATCH 5/5] xfs: fix btree scrub deref check Darrick J. Wong
2017-11-09  2:16   ` Dave Chinner
2017-11-08 20:56 ` [PATCH 6/5] xfs: only check da node header padding on v5 filesystems Darrick J. Wong
2017-11-09  2:17   ` Dave Chinner
2017-11-09  6:00 ` [PATCH 7/5] xfs: on failed mount, force-reclaim inodes after unmounting quota controls Darrick J. Wong
2017-11-09 23:24   ` Dave Chinner
2017-11-09 23:49     ` Darrick J. Wong [this message]
2017-11-09 23:57   ` [PATCH v2 " Darrick J. Wong
2017-11-10  1:19     ` Dave Chinner
2017-11-09 17:35 ` [PATCH 8/5] xfs: remove u_int* type usage Darrick J. Wong
2017-11-09 23:25   ` Dave Chinner

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=20171109234928.GP26910@magnolia \
    --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 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).