Commit a95ff94
committed
Merge: xfs: fix sparse inode limits on runt AG
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5846
JIRA: https://issues.redhat.com/browse/RHEL-68541
Upstream Status: https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git for-next
Conflicts: changed context due to unbackported upstream commit
6abd82a xfs: add a xfs_agino_to_ino helper
e9c4d8b xfs: factor out a generic xfs_group structure
The runt AG at the end of a filesystem is almost always smaller than
the mp->m_sb.sb_agblocks. Unfortunately, when setting the max_agbno
limit for the inode chunk allocation, we do not take this into
account. This means we can allocate a sparse inode chunk that
overlaps beyond the end of an AG. When we go to allocate an inode
from that sparse chunk, the irec fails validation because the
agbno of the start of the irec is beyond valid limits for the runt
AG.
Prevent this from happening by taking into account the size of the
runt AG when allocating inode chunks. Also convert the various
checks for valid inode chunk agbnos to use xfs_ag_block_count()
so that they will also catch such issues in the future.
Fixes: 56d1115 ("xfs: allocate sparse inode chunks on full chunk allocation failure")
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Pavel Reichl <preichl@redhat.com>
Approved-by: Carlos Maiolino <cmaiolino@redhat.com>
Approved-by: Bill O'Donnell <bodonnel@redhat.com>
Approved-by: Ian Kent <ikent@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>
Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>1 file changed
+9
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
799 | | - | |
| 799 | + | |
| 800 | + | |
800 | 801 | | |
801 | 802 | | |
802 | 803 | | |
| |||
2190 | 2191 | | |
2191 | 2192 | | |
2192 | 2193 | | |
2193 | | - | |
2194 | | - | |
2195 | | - | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
2196 | 2197 | | |
2197 | 2198 | | |
2198 | 2199 | | |
| |||
2315 | 2316 | | |
2316 | 2317 | | |
2317 | 2318 | | |
2318 | | - | |
| 2319 | + | |
2319 | 2320 | | |
2320 | 2321 | | |
2321 | 2322 | | |
| |||
2325 | 2326 | | |
2326 | 2327 | | |
2327 | 2328 | | |
2328 | | - | |
| 2329 | + | |
2329 | 2330 | | |
2330 | 2331 | | |
2331 | 2332 | | |
2332 | | - | |
| 2333 | + | |
| 2334 | + | |
2333 | 2335 | | |
2334 | 2336 | | |
2335 | 2337 | | |
| |||
0 commit comments