After xfs_alloc_compute_diff(), the length of the candidate extent may change, so make necessary corrections to args->len. Signed-off-by: Jinliang Zheng <alexjlzheng@xxxxxxxxxxx> --- fs/xfs/libxfs/xfs_alloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index 22bdbb3e9980..6a5e6cc7a259 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -1069,6 +1069,10 @@ xfs_alloc_cur_check( if (bnew == NULLAGBLOCK) goto out; + args->len = XFS_EXTLEN_MIN(bnoa + lena - bnew, args->maxlen); + if (args->len < acur->len) + goto out; + /* * Deactivate a bnobt cursor with worse locality than the current best. */ -- 2.41.1