From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Date: Fri, 01 Feb 2013 21:13:28 +0000 Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Get a block reservation before resizing a file In-Reply-To: <1847869626.18286471.1359738182937.JavaMail.root@redhat.com> References: <1847869626.18286471.1359738182937.JavaMail.root@redhat.com> Message-ID: <1359753208.2714.80.camel@menhir> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, Now in the -nmw tree. Thanks, Steve. On Fri, 2013-02-01 at 12:03 -0500, Bob Peterson wrote: > Hi, > > 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. > > Regards, > > Bob Peterson > Red Hat File Systems > > Signed-off-by: Bob Peterson > --- > fs/gfs2/bmap.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c > index d29d779..df686d1 100644 > --- a/fs/gfs2/bmap.c > +++ b/fs/gfs2/bmap.c > @@ -1288,6 +1288,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); >