diff options
author | Carlos Maiolino <cmaiolino@redhat.com> | 2017-08-18 18:07:04 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2017-08-22 09:22:24 -0700 |
commit | 2d32311cf19bfb8c1d2b4601974ddd951f9cfd0b (patch) | |
tree | 359b7501bd1f404ecc20229272ecc5d20f88ad87 /fs/xfs/xfs_xattr.c | |
parent | e67d3d4246e5fbb0c7c700426d11241ca9c6f473 (diff) | |
download | linux-stable-2d32311cf19bfb8c1d2b4601974ddd951f9cfd0b.tar.gz linux-stable-2d32311cf19bfb8c1d2b4601974ddd951f9cfd0b.tar.bz2 linux-stable-2d32311cf19bfb8c1d2b4601974ddd951f9cfd0b.zip |
xfs: stop searching for free slots in an inode chunk when there are none
In a filesystem without finobt, the Space manager selects an AG to alloc a new
inode, where xfs_dialloc_ag_inobt() will search the AG for the free slot chunk.
When the new inode is in the same AG as its parent, the btree will be searched
starting on the parent's record, and then retried from the top if no slot is
available beyond the parent's record.
To exit this loop though, xfs_dialloc_ag_inobt() relies on the fact that the
btree must have a free slot available, once its callers relied on the
agi->freecount when deciding how/where to allocate this new inode.
In the case when the agi->freecount is corrupted, showing available inodes in an
AG, when in fact there is none, this becomes an infinite loop.
Add a way to stop the loop when a free slot is not found in the btree, making
the function to fall into the whole AG scan which will then, be able to detect
the corruption and shut the filesystem down.
As pointed by Brian, this might impact performance, giving the fact we
don't reset the search distance anymore when we reach the end of the
tree, giving it fewer tries before falling back to the whole AG search, but
it will only affect searches that start within 10 records to the end of the tree.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_xattr.c')
0 files changed, 0 insertions, 0 deletions