Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359013
b: refs/heads/master
c: 8d8759e
h: refs/heads/master
i:
  359011: 6eaf2e9
v: v3
  • Loading branch information
Wang Shilong authored and Jan Kara committed Jan 21, 2013
1 parent b7552af commit c45c58a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f56426ae4d4414c9c996567710dceecbdfc39acc
refs/heads/master: 8d8759eb488f9e88fa5f976c4fd7ed205661c872
12 changes: 12 additions & 0 deletions trunk/fs/ext2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,10 @@ static int ext2_alloc_branch(struct inode *inode,
* parent to disk.
*/
bh = sb_getblk(inode->i_sb, new_blocks[n-1]);
if (unlikely(!bh)) {
err = -ENOMEM;
goto failed;
}
branch[n].bh = bh;
lock_buffer(bh);
memset(bh->b_data, 0, blocksize);
Expand Down Expand Up @@ -523,6 +527,14 @@ static int ext2_alloc_branch(struct inode *inode,
}
*blks = num;
return err;

failed:
for (i = 1; i < n; i++)
bforget(branch[i].bh);
for (i = 0; i < indirect_blks; i++)
ext2_free_blocks(inode, new_blocks[i], 1);
ext2_free_blocks(inode, new_blocks[i], num);
return err;
}

/**
Expand Down

0 comments on commit c45c58a

Please sign in to comment.