• Christoph Hellwig's avatar
    xfs: distinguish extra split from real ENOSPC from xfs_attr3_leaf_split · a5f73342
    Christoph Hellwig authored
    xfs_attr3_leaf_split propagates the need for an extra btree split as
    -ENOSPC to it's only caller, but the same return value can also be
    returned from xfs_da_grow_inode when it fails to find free space.
    
    Distinguish the two cases by returning 1 for the extra split case instead
    of overloading -ENOSPC.
    
    This can be triggered relatively easily with the pending realtime group
    support and a file system with a lot of small zones that use metadata
    space on the main device.  In this case every about 5-10th run of
    xfs/538 runs into the following assert:
    
    	ASSERT(oldblk->magic == XFS_ATTR_LEAF_MAGIC);
    
    in xfs_attr3_leaf_split caused by an allocation failure.  Note that
    the allocation failure is caused by another bug that will be fixed
    subsequently, but this commit at least sorts out the error handling.
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
    a5f73342
xfs_da_btree.c 74.7 KB