diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-09-07 15:44:28 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-09-07 15:44:28 -0700 |
commit | fa2925cf90e612cb9c10c45d0cb8a7c7332e56a7 (patch) | |
tree | b836666993fac5c9a157c2cb756c33fb66cb13e8 /fs/xfs/xfs_vnodeops.c | |
parent | 98e52c373cdc1239a9ec6a2763f519cc1d99dcbc (diff) | |
parent | cb7a93412ab52361bc255cbe2c767e0741c09f43 (diff) | |
download | kernel_samsung_smdk4412-fa2925cf90e612cb9c10c45d0cb8a7c7332e56a7.zip kernel_samsung_smdk4412-fa2925cf90e612cb9c10c45d0cb8a7c7332e56a7.tar.gz kernel_samsung_smdk4412-fa2925cf90e612cb9c10c45d0cb8a7c7332e56a7.tar.bz2 |
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
* 'for-linus' of git://oss.sgi.com/xfs/xfs:
xfs: Make fiemap work with sparse files
xfs: prevent 32bit overflow in space reservation
xfs: Disallow 32bit project quota id
xfs: improve buffer cache hash scalability
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 66d585c..4c7c7bf 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c @@ -2299,15 +2299,22 @@ xfs_alloc_file_space( e = allocatesize_fsb; } + /* + * The transaction reservation is limited to a 32-bit block + * count, hence we need to limit the number of blocks we are + * trying to reserve to avoid an overflow. We can't allocate + * more than @nimaps extents, and an extent is limited on disk + * to MAXEXTLEN (21 bits), so use that to enforce the limit. + */ + resblks = min_t(xfs_fileoff_t, (e - s), (MAXEXTLEN * nimaps)); if (unlikely(rt)) { - resrtextents = qblocks = (uint)(e - s); + resrtextents = qblocks = resblks; resrtextents /= mp->m_sb.sb_rextsize; resblks = XFS_DIOSTRAT_SPACE_RES(mp, 0); quota_flag = XFS_QMOPT_RES_RTBLKS; } else { resrtextents = 0; - resblks = qblocks = \ - XFS_DIOSTRAT_SPACE_RES(mp, (uint)(e - s)); + resblks = qblocks = XFS_DIOSTRAT_SPACE_RES(mp, resblks); quota_flag = XFS_QMOPT_RES_REGBLKS; } |