aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2006-06-25 05:47:28 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 10:01:04 -0700
commitf391475812ba39afa322c835217ffe936f5e754a (patch)
treed5bf0a5ec79b0bebe87988734c316b18360f42a8 /fs
parent96710b29e05f3b470bc4206366021b56e28d5208 (diff)
downloadkernel_samsung_crespo-f391475812ba39afa322c835217ffe936f5e754a.zip
kernel_samsung_crespo-f391475812ba39afa322c835217ffe936f5e754a.tar.gz
kernel_samsung_crespo-f391475812ba39afa322c835217ffe936f5e754a.tar.bz2
[PATCH] ufs: missed brelse and wrong baseblk
This patch fixes two bugs, which introduced by previous patches: 1) Missed "brelse" 2) Sometimes "baseblk" may be wrongly calculated, if i_size is equal to zero, which lead infinite cycle in "mpage_writepages". Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ufs/balloc.c12
-rw-r--r--fs/ufs/inode.c1
2 files changed, 6 insertions, 7 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index ac709e7..99d8818 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -269,20 +269,17 @@ out:
* We can come here from ufs_writepage or ufs_prepare_write,
* locked_page is argument of these functions, so we already lock it.
*/
-static void ufs_change_blocknr(struct inode *inode, unsigned int count,
- unsigned int oldb, unsigned int newb,
- struct page *locked_page)
+static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk,
+ unsigned int count, unsigned int oldb,
+ unsigned int newb, struct page *locked_page)
{
unsigned int blk_per_page = 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits);
- sector_t baseblk;
struct address_space *mapping = inode->i_mapping;
pgoff_t index, cur_index = locked_page->index;
unsigned int i, j;
struct page *page;
struct buffer_head *head, *bh;
- baseblk = ((i_size_read(inode) - 1) >> inode->i_blkbits) + 1 - count;
-
UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n",
inode->i_ino, count, oldb, newb);
@@ -439,7 +436,8 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
}
result = ufs_alloc_fragments (inode, cgno, goal, request, err);
if (result) {
- ufs_change_blocknr(inode, oldcount, tmp, result, locked_page);
+ ufs_change_blocknr(inode, fragment - oldcount, oldcount, tmp,
+ result, locked_page);
*p = cpu_to_fs32(sb, result);
*err = 0;
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 7228204..01c5f19 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -175,6 +175,7 @@ ufs_clear_frags(struct inode *inode, sector_t beg,
for (++beg; beg < end; ++beg) {
bh = sb_getblk(inode->i_sb, beg);
ufs_clear_frag(inode, bh);
+ brelse(bh);
}
return res;
}