[PATCH 2/2] xfs: Limit total allocation request to maximum possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The original allocation request may have a total value way beyond
possible limits.

Trim it down to the maximum possible if needed

Signed-off-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
---
 fs/xfs/libxfs/xfs_bmap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 07aad70f3931..3aa0bf5cc7e3 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -3477,6 +3477,11 @@ xfs_bmap_btalloc(
 			error = xfs_bmap_btalloc_filestreams(ap, &args, &blen);
 		else
 			error = xfs_bmap_btalloc_nullfb(ap, &args, &blen);
+
+		/* We can never have total larger than blen, so trim it now */
+		if (args.total > blen)
+			args.total = blen;
+
 		if (error)
 			return error;
 	} else if (ap->tp->t_flags & XFS_TRANS_LOWMODE) {
-- 
2.20.1




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux