xfs
[Top] [All Lists]

Re: [PATCH] xfs: clean up xfs_set_maxicount & use in growfs

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH] xfs: clean up xfs_set_maxicount & use in growfs
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 27 Feb 2014 18:11:54 +1100
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, Eric Sandeen <sandeen@xxxxxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <530E3282.7000703@xxxxxxxxxxx>
References: <530C29C7.90001@xxxxxxxxxx> <20140226021114.GA26022@xxxxxxxxxxxxx> <530E3282.7000703@xxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Wed, Feb 26, 2014 at 12:29:22PM -0600, Eric Sandeen wrote:
> On 2/25/14, 8:11 PM, Christoph Hellwig wrote:
> > On Mon, Feb 24, 2014 at 11:27:35PM -0600, Eric Sandeen wrote:
> >> xfs_set_maxicount() overflowed fairly easily for large filesystems
> >> and large maxicount; we started out by multiplying dblocks by
> >> the percentage, *then* dividing by 100, and never checked for
> >> an overflow.  The calculations were also, IMHO, a little hard
> >> to follow.
> > 
> > Would be useful to get this test case into xfstests..
> 
> Ok so I was going on Dave's assertion about that.  ;)
> 
> To overflow, we'd need dblocks * 100 to be > 2^64-1:
> 
> so dblocks would need to be > (2^64-1)/100
> 
> for 4k blocks that's 655 exabytes.  Maybe not so possible after all ;)

Until the block count is corrupted by fsfuzzer? ;)

> Dave, maybe just removing the open-code is enough here.

Sure, but I still like the conversion to use mult_frac....

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>