소스 검색

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>
Bob Peterson 13 년 전
부모
커밋
d2b47cfb26
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      fs/gfs2/bmap.c

+ 4 - 0
fs/gfs2/bmap.c

@@ -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);