aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_address.c
diff options
context:
space:
mode:
authorRussell Cattelan <cattelan@redhat.com>2006-10-09 13:11:54 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-10-12 17:09:54 -0400
commit52ae7b7935a079aaba25da98fe90772d04109f26 (patch)
treef03dbb3037136fe72fb05d886eb5a2b48c0548c1 /fs/gfs2/ops_address.c
parentc25d5180441e344a3368d100c57f0a481c6944f7 (diff)
[GFS2] Fix a size calculation error
Fix a size calculation error. The size was incorrect being computed as a negative length and then being passed to an unsigned parameter. This in turn would cause the allocator to think it needed enough meta data to store a gigabyte file for every file created. Signed-off-by: Russell Cattelan <cattelan@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r--fs/gfs2/ops_address.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 4fb743f4e4a4..bdf56cf66224 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -370,15 +370,17 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
370 loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + from; 370 loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + from;
371 loff_t end = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; 371 loff_t end = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
372 struct gfs2_alloc *al; 372 struct gfs2_alloc *al;
373 unsigned int write_len = to - from;
374
373 375
374 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME|GL_AOP, &ip->i_gh); 376 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME|GL_AOP, &ip->i_gh);
375 error = gfs2_glock_nq_m_atime(1, &ip->i_gh); 377 error = gfs2_glock_nq_m_atime(1, &ip->i_gh);
376 if (error) 378 if (error)
377 goto out_uninit; 379 goto out_uninit;
378 380
379 gfs2_write_calc_reserv(ip, to - from, &data_blocks, &ind_blocks); 381 gfs2_write_calc_reserv(ip, write_len, &data_blocks, &ind_blocks);
380 382
381 error = gfs2_write_alloc_required(ip, pos, from - to, &alloc_required); 383 error = gfs2_write_alloc_required(ip, pos, write_len, &alloc_required);
382 if (error) 384 if (error)
383 goto out_unlock; 385 goto out_unlock;
384 386