summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/mmap.h
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2019-11-27 01:58:07 +0100
committerDarrick J. Wong <darrick.wong@oracle.com>2019-12-03 02:58:50 +0100
commit0c4da70c83d41a8461fdf50a3f7b292ecb04e378 (patch)
tree7d96ea334f79126cb6201ec7966b7c5ce9ef0c75 /fs/ocfs2/mmap.h
parentxfs: allow parent directory scans to be interrupted with fatal signals (diff)
downloadlinux-0c4da70c83d41a8461fdf50a3f7b292ecb04e378.tar.xz
linux-0c4da70c83d41a8461fdf50a3f7b292ecb04e378.zip
xfs: fix realtime file data space leak
Realtime files in XFS allocate extents in rextsize units. However, the written/unwritten state of those extents is still tracked in blocksize units. Therefore, a realtime file can be split up into written and unwritten extents that are not necessarily aligned to the realtime extent size. __xfs_bunmapi() has some logic to handle these various corner cases. Consider how it handles the following case: 1. The last extent is unwritten. 2. The last extent is smaller than the realtime extent size. 3. startblock of the last extent is not aligned to the realtime extent size, but startblock + blockcount is. In this case, __xfs_bunmapi() calls xfs_bmap_add_extent_unwritten_real() to set the second-to-last extent to unwritten. This should merge the last and second-to-last extents, so __xfs_bunmapi() moves on to the second-to-last extent. However, if the size of the last and second-to-last extents combined is greater than MAXEXTLEN, xfs_bmap_add_extent_unwritten_real() does not merge the two extents. When that happens, __xfs_bunmapi() skips past the last extent without unmapping it, thus leaking the space. Fix it by only unwriting the minimum amount needed to align the last extent to the realtime extent size, which is guaranteed to merge with the last extent. Signed-off-by: Omar Sandoval <osandov@fb.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/ocfs2/mmap.h')
0 files changed, 0 insertions, 0 deletions