diff options
-rw-r--r-- | fs/jfs/jfs_dtree.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 73b5fc7eda80..404f33eae507 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -381,9 +381,12 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) | |||
381 | * It's time to move the inline table to an external | 381 | * It's time to move the inline table to an external |
382 | * page and begin to build the xtree | 382 | * page and begin to build the xtree |
383 | */ | 383 | */ |
384 | if (DQUOT_ALLOC_BLOCK(ip, sbi->nbperpage) || | 384 | if (DQUOT_ALLOC_BLOCK(ip, sbi->nbperpage)) |
385 | dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) | 385 | goto clean_up; |
386 | goto clean_up; /* No space */ | 386 | if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) { |
387 | DQUOT_FREE_BLOCK(ip, sbi->nbperpage); | ||
388 | goto clean_up; | ||
389 | } | ||
387 | 390 | ||
388 | /* | 391 | /* |
389 | * Save the table, we're going to overwrite it with the | 392 | * Save the table, we're going to overwrite it with the |
@@ -397,13 +400,15 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) | |||
397 | xtInitRoot(tid, ip); | 400 | xtInitRoot(tid, ip); |
398 | 401 | ||
399 | /* | 402 | /* |
400 | * Allocate the first block & add it to the xtree | 403 | * Add the first block to the xtree |
401 | */ | 404 | */ |
402 | if (xtInsert(tid, ip, 0, 0, sbi->nbperpage, &xaddr, 0)) { | 405 | if (xtInsert(tid, ip, 0, 0, sbi->nbperpage, &xaddr, 0)) { |
403 | /* This really shouldn't fail */ | 406 | /* This really shouldn't fail */ |
404 | jfs_warn("add_index: xtInsert failed!"); | 407 | jfs_warn("add_index: xtInsert failed!"); |
405 | memcpy(&jfs_ip->i_dirtable, temp_table, | 408 | memcpy(&jfs_ip->i_dirtable, temp_table, |
406 | sizeof (temp_table)); | 409 | sizeof (temp_table)); |
410 | dbFree(ip, xaddr, sbi->nbperpage); | ||
411 | DQUOT_FREE_BLOCK(ip, sbi->nbperpage); | ||
407 | goto clean_up; | 412 | goto clean_up; |
408 | } | 413 | } |
409 | ip->i_size = PSIZE; | 414 | ip->i_size = PSIZE; |