]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
GFS2: Get a block reservation before resizing a file
authorBob Peterson <rpeterso@redhat.com>
Fri, 1 Feb 2013 17:03:02 +0000 (12:03 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Feb 2013 13:38:33 +0000 (05:38 -0800)
commit d2b47cfb26fe06002b8011707baac71a9ae8166f upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/bmap.c

index a68e91bcef3ddf7d005665955ecff7909ccb171f..9a3945a7f48fe25f6ebf5562fa1fb9b35395db61 100644 (file)
@@ -1286,6 +1286,10 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
 
        inode_dio_wait(inode);
 
+       ret = gfs2_rs_alloc(GFS2_I(inode));
+       if (ret)
+               return ret;
+
        oldsize = inode->i_size;
        if (newsize >= oldsize)
                return do_grow(inode, newsize);