Commit d2b47cfb authored by Bob Peterson's avatar Bob Peterson Committed by Steven Whitehouse

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: default avatarBob Peterson <rpeterso@redhat.com>
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 4506a519
...@@ -1288,6 +1288,10 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize) ...@@ -1288,6 +1288,10 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
inode_dio_wait(inode); inode_dio_wait(inode);
ret = gfs2_rs_alloc(GFS2_I(inode));
if (ret)
return ret;
oldsize = inode->i_size; oldsize = inode->i_size;
if (newsize >= oldsize) if (newsize >= oldsize)
return do_grow(inode, newsize); return do_grow(inode, newsize);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment