Re: [PATCH 3/8] xfs: don't trip over negative free space in xfs_reserve_blocks

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

 



On Thu, Jun 21, 2018 at 11:31:22AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> If we somehow end up with a filesystem that has fewer free blocks than
> the blocks set aside to avoid ENOSPC deadlocks, it's possible that the
> free space calculation in xfs_reserve_blocks will spit out a negative
> number (because percpu_counter_sum returns s64).  We fail to notice
> this negative number and set fdblks_delta to it.  Now we increment
> fdblocks(!) and the unsigned type of m_resblks means that we end up
> setting a ridiculously huge m_resblks reservation.
> 
> Avoid this comedy of errors by detecting the negative free space and
> returning -ENOSPC.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

Looks good,

Reviewed-by: Christoph Hellwig <hch@xxxxxx>
--
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