diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-06-22 02:26:58 -0400 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-06-24 14:56:36 -0400 |
commit | a3a374bf1889b1b401b25e6aada3ca4151a99d15 (patch) | |
tree | fcc3f1b4f93b9a70f60a89f046ca431fccec1ffe | |
parent | 232d0a24b0fc197c50e95fe65f236027b5fa1b74 (diff) |
xfs: fix off-by-one error in xfs_rtalloc_query_range
In commit 8ad560d2565e6 ("xfs: strengthen rtalloc query range checks")
we strengthened the input parameter checks in the rtbitmap range query
function, but introduced an off-by-one error in the process. The call
to xfs_rtfind_forw deals with the high key being rextents, but we clamp
the high key to rextents - 1. This causes the returned results to stop
one block short of the end of the rtdev, which is incorrect.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | fs/xfs/libxfs/xfs_rtbitmap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c index 65fc4ed2e9a1..b228c821bae6 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.c +++ b/fs/xfs/libxfs/xfs_rtbitmap.c | |||
@@ -1029,8 +1029,8 @@ xfs_rtalloc_query_range( | |||
1029 | if (low_rec->ar_startext >= mp->m_sb.sb_rextents || | 1029 | if (low_rec->ar_startext >= mp->m_sb.sb_rextents || |
1030 | low_rec->ar_startext == high_rec->ar_startext) | 1030 | low_rec->ar_startext == high_rec->ar_startext) |
1031 | return 0; | 1031 | return 0; |
1032 | if (high_rec->ar_startext >= mp->m_sb.sb_rextents) | 1032 | if (high_rec->ar_startext > mp->m_sb.sb_rextents) |
1033 | high_rec->ar_startext = mp->m_sb.sb_rextents - 1; | 1033 | high_rec->ar_startext = mp->m_sb.sb_rextents; |
1034 | 1034 | ||
1035 | /* Iterate the bitmap, looking for discrepancies. */ | 1035 | /* Iterate the bitmap, looking for discrepancies. */ |
1036 | rtstart = low_rec->ar_startext; | 1036 | rtstart = low_rec->ar_startext; |