[PATCH V2] xfs: prevent xfs_bmap_extsize_align() to exceed maximum extent size.

Alain Renaud arenaud at sgi.com
Fri Jul 20 03:05:01 CDT 2012


On 12-07-20 03:44 AM, Dave Chinner wrote:
>
>>>
>> If you look in the function where I put this code is it AFTER the
>> head/len alignment so the HEAD is already align so I do not need to
>> account for it.
> No need to shout. I did look at the code, and IMO you do need to
> account for both head and tail extension and you definitely can't do
> it there.....
Sorry for the cap I did not intend to shout.

However the problem does exist. the len limitation in xfs_bmapi_write is 
not sufficient
if you set the extsize.

Here is what I see.

xfs_bmapi_write() <= lenght limited to MAXEXTLEN;
     xfs_bmapi_allocate()
           xfs_bmap_alloc()
                 xfs_bmap_btalloc()
                       xfs_bmap_extsize_align()  <== Align the offest / len

Since the alignment is outward like you explain bellow we return len > 
MAXEXTLEN
causing failure to report ENOSPC.

You can reproduce the problem the following way.

# uname -r
3.5.0-rc1-0.2-default+

# mkfs.xfs -f -b size=512 -d agcount=1,size=4294967296 /dev/sdb5

meta-data=/dev/sdb5              isize=256    agcount=1, agsize=8388608 blks
          =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=512    blocks=8388608, imaxpct=25
          =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=512    blocks=20480, version=2
          =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

# mount /dev/sdb5 /a

# xfs_io -f -c "extsize 2m" -c "resvsp 0 1g" /a/data1
XFS_IOC_RESVSP64: No space left on device


So Maybe the fix is to limit the bma.length in xfs_bmapi_write to MAXEXTLEN 
- (2 * extsz - 1) like you do in xfs_bmapi_reserve_delalloc().


Hope this is making sense.




-- 
===============================================
Alain Renaud     - Cluster File System Engineer
arenaud at sgi.com  - SGI
===============================================





More information about the xfs mailing list