From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs: avoid overflows in i_delayed_blks due to numerous cow reservations
Date: Thu, 2 Aug 2018 11:02:56 -0700 [thread overview]
Message-ID: <20180802180256.GR30972@magnolia> (raw)
From: Darrick J. Wong <darrick.wong@oracle.com>
Prior to the arrival of copy on write, i_delayed_blks tracked the number
of blocks that had been reserved for delayed allocations. Though the
counter was 32-bits in size, this was enough because writeback would
generally start flushing files well before we hit 2^32 blocks of dirty
data.
However, now that we're using it to track CoW reservations as well, it's
possible to create so many of those reservations that we overflow the
counter. This is kind of an extreme case (it requires ~16T of COW
reservations) but we ought to avoid this trivial overflow. A userspace
visible effect is that stat i_blocks returns incorrect values.
Change the field to xfs_filblks_t, which should suffice to fix the
problem. There already was a 4-byte hole in struct xfs_inode, so we get
this for free.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/xfs_inode.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 59b06133ceb8..3fd0e07a363e 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -48,7 +48,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 */
+ xfs_filblks_t i_delayed_blks; /* count of delay alloc blks */
struct xfs_icdinode i_d; /* most of ondisk inode */
next reply other threads:[~2018-08-02 19:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 18:02 Darrick J. Wong [this message]
2018-08-02 20:22 ` [PATCH] xfs: avoid overflows in i_delayed_blks due to numerous cow reservations Eric Sandeen
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=20180802180256.GR30972@magnolia \
--to=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