summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2018-06-01 22:09:50 -0500
committerBob Peterson <rpeterso@redhat.com>2018-06-04 07:33:42 -0500
commitdc8fbb03dcd6df78027ccec61ff2a0bba436d38e (patch)
tree48a0d114551bda20465657404bae82280517ca57 /drivers
parent7b5747f43f4dd8dce57e686ca4372825bd67c258 (diff)
GFS2: gfs2_free_extlen can return an extent that is too long
Function gfs2_free_extlen calculates the length of an extent of free blocks that may be reserved. The end pointer was calculated as end = start + bh->b_size but b_size is incorrect because the bitmap usually stops prior to the end of the buffer data on the last bitmap. What this means is that when you do a write, you can reserve a chunk of blocks that runs off the end of the last bitmap. For example, I've got a file system where there is only one bitmap for each rgrp, so ri_length==1. I saw cases in which iozone tried to do a big write, grabbed a large block reservation, chose rgrp 5464152, which has ri_data0 5464153 and ri_data 8188. So 5464153 + 8188 = 5472341 which is the end of the rgrp. When it grabbed a reservation it got back: 5470936, length 7229. But 5470936 + 7229 = 5478165. So the reservation starts inside the rgrp but runs 5824 blocks past the end of the bitmap. This patch fixes the calculation so it won't exceed the last bitmap. It also adds a BUG_ON to guard against overflows in the future. Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'drivers')
0 files changed, 0 insertions, 0 deletions