diff options
author | Bob Peterson <rpeterso@redhat.com> | 2013-02-01 12:03:02 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2013-02-01 15:37:33 -0500 |
commit | d2b47cfb26fe06002b8011707baac71a9ae8166f (patch) | |
tree | be4f83991b3945536e5cb336cba3b47262ff633d /fs/gfs2/bmap.c | |
parent | 4506a519f2a76775e6c236f44d50e9f79a7d3434 (diff) |
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>
Diffstat (limited to 'fs/gfs2/bmap.c')
-rw-r--r-- | fs/gfs2/bmap.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index d29d7793b211..df686d13a7d2 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -1288,6 +1288,10 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize) | |||
1288 | 1288 | ||
1289 | inode_dio_wait(inode); | 1289 | inode_dio_wait(inode); |
1290 | 1290 | ||
1291 | ret = gfs2_rs_alloc(GFS2_I(inode)); | ||
1292 | if (ret) | ||
1293 | return ret; | ||
1294 | |||
1291 | oldsize = inode->i_size; | 1295 | oldsize = inode->i_size; |
1292 | if (newsize >= oldsize) | 1296 | if (newsize >= oldsize) |
1293 | return do_grow(inode, newsize); | 1297 | return do_grow(inode, newsize); |