From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: widen inode delalloc block counter to 64-bits
Date: Thu, 18 Apr 2019 07:10:42 +1000 [thread overview]
Message-ID: <20190417211042.GP29573@dread.disaster.area> (raw)
In-Reply-To: <155546519490.176148.10439883748477358842.stgit@magnolia>
On Tue, Apr 16, 2019 at 06:39:54PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Widen the incore inode's i_delayed_blks counter to be a 64-bit integer.
> This is necessary to fix an integer overflow problem that can be
> reproduced easily now that we use the counter to track blocks that are
> assigned to the inode in memory but not on disk. This includes actual
> delalloc reservations as well as real extents in the COW fork that
> are waiting to be remapped into the data fork.
>
> These 'delayed mapping' blocks can easily exceed 2^32 blocks if one
> creates a very large sparse file of size approximately 2^33 bytes with
> one byte written every 2^23 bytes, sets a very large COW extent size
> hint of 2^23 blocks, reflinks the first file into a second file, and
> then writes a single byte every 2^23 blocks in the original file.
>
> When this happens, we'll try to create approximately 1024 2^23 extent
> reservations in the COW fork, which will overflow the counter and cause
> problems.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_inode.h | 2 +-
> fs/xfs/xfs_qm.c | 3 ++-
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
>
> diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
> index 87e701b638ae..558173f95a03 100644
> --- a/fs/xfs/xfs_inode.h
> +++ b/fs/xfs/xfs_inode.h
> @@ -56,7 +56,7 @@ typedef struct xfs_inode {
> spinlock_t i_flags_lock; /* inode i_flags lock */
> /* Miscellaneous state. */
> unsigned long i_flags; /* see defined flags below */
> - unsigned int i_delayed_blks; /* count of delay alloc blks */
> + uint64_t i_delayed_blks; /* count of delay alloc blks */
>
> struct xfs_icdinode i_d; /* most of ondisk inode */
This fills a 4 byte hole in the structure, yes? Might be worth
mentioning in the commit log that it doesn't increase the size of
the struct inode, then.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2019-04-17 21:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-17 1:39 [PATCH 0/2] xfs: prevent overflow of delalloc block counters Darrick J. Wong
2019-04-17 1:39 ` [PATCH 1/2] xfs: widen quota block counters to 64-bit integers Darrick J. Wong
2019-04-17 3:06 ` Allison Henderson
2019-04-17 6:25 ` Darrick J. Wong
2019-04-17 21:08 ` Dave Chinner
2019-04-23 6:27 ` Christoph Hellwig
2019-04-17 1:39 ` [PATCH 2/2] xfs: widen inode delalloc block counter to 64-bits Darrick J. Wong
2019-04-17 3:06 ` Allison Henderson
2019-04-17 21:10 ` Dave Chinner [this message]
2019-04-23 6:28 ` Christoph Hellwig
2019-04-17 6:24 ` [PATCH 3/2] xfstests: check for COW overflows in i_delayed_blks Darrick J. Wong
2019-04-17 21:29 ` Dave Chinner
2019-04-17 22:24 ` 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=20190417211042.GP29573@dread.disaster.area \
--to=david@fromorbit.com \
--cc=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