From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: xfs <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfs: enforce imax_pct when we have per-cpu SB accounting
Date: Wed, 6 May 2015 08:14:34 +1000 [thread overview]
Message-ID: <20150505221434.GH21261@dastard> (raw)
In-Reply-To: <20150505220208.GC11601@birch.djwong.org>
On Tue, May 05, 2015 at 03:02:08PM -0700, Darrick J. Wong wrote:
> When per-CPU superblock counters are enabled (i.e. SMP=y), we don't
> update the in-core superblock's sb_icount value prior to checking if
> we're already at maximum inodes. Therefore, it's possible for a tight
> file creation loop (e.g. "for i in {0..100000}; do touch /mnt/$i;
> done") to allocate far more inodes than the administrator specified at
> mkfs time. Fix this by synchronizing the counters every time we think
> we need to allocate another chunk of inodes.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/libxfs/xfs_ialloc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index 116ef1d..a8aaab6 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -375,6 +375,8 @@ xfs_ialloc_ag_alloc(
> * at one time.
> */
> newlen = args.mp->m_ialloc_inos;
> + if (args.mp->m_maxicount)
> + xfs_icsb_sync_counters(args.mp, 0);
> if (args.mp->m_maxicount &&
> args.mp->m_sb.sb_icount + newlen > args.mp->m_maxicount)
> return -ENOSPC;
> @@ -1339,6 +1341,8 @@ xfs_dialloc(
> * okalloc so we scan all available agi structures for a free
> * inode.
> */
> + if (mp->m_maxicount)
> + xfs_icsb_sync_counters(mp, 0);
> if (mp->m_maxicount &&
> mp->m_sb.sb_icount + mp->m_ialloc_inos > mp->m_maxicount) {
> noroom = 1;
As i mentioned on IRC, sb_icount is now using the generic percpu
counter infrastrcture, so shouldn't have this problem - overshoot
should be, at maximum, (Ncpus * 32).
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2015-05-05 22:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-05 22:02 [PATCH] xfs: enforce imax_pct when we have per-cpu SB accounting Darrick J. Wong
2015-05-05 22:14 ` Dave Chinner [this message]
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=20150505221434.GH21261@dastard \
--to=david@fromorbit.com \
--cc=darrick.wong@oracle.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