Skip to content

Commit d2b47cf

Browse files
AstralBobswhiteho
authored andcommitted
GFS2: Get a block reservation before resizing a file
This patch allocates a block reservation structure before growing or shrinking a file. Without this structure, the grow or shink code can reference the bad pointer. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
1 parent 4506a51 commit d2b47cf

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎fs/gfs2/bmap.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,10 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
12881288

12891289
inode_dio_wait(inode);
12901290

1291+
ret = gfs2_rs_alloc(GFS2_I(inode));
1292+
if (ret)
1293+
return ret;
1294+
12911295
oldsize = inode->i_size;
12921296
if (newsize >= oldsize)
12931297
return do_grow(inode, newsize);

0 commit comments

Comments
 (0)