[PATCH] xfs: avoid overflows in i_delayed_blks due to numerous cow reservations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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 */
 
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux