diff options
Diffstat (limited to 'fs/ext3/namei.c')
-rw-r--r-- | fs/ext3/namei.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index dec3e0d88ab1..0b8cf80154f1 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -57,10 +57,15 @@ static struct buffer_head *ext3_append(handle_t *handle, | |||
57 | 57 | ||
58 | *block = inode->i_size >> inode->i_sb->s_blocksize_bits; | 58 | *block = inode->i_size >> inode->i_sb->s_blocksize_bits; |
59 | 59 | ||
60 | if ((bh = ext3_bread(handle, inode, *block, 1, err))) { | 60 | bh = ext3_bread(handle, inode, *block, 1, err); |
61 | if (bh) { | ||
61 | inode->i_size += inode->i_sb->s_blocksize; | 62 | inode->i_size += inode->i_sb->s_blocksize; |
62 | EXT3_I(inode)->i_disksize = inode->i_size; | 63 | EXT3_I(inode)->i_disksize = inode->i_size; |
63 | ext3_journal_get_write_access(handle,bh); | 64 | *err = ext3_journal_get_write_access(handle, bh); |
65 | if (*err) { | ||
66 | brelse(bh); | ||
67 | bh = NULL; | ||
68 | } | ||
64 | } | 69 | } |
65 | return bh; | 70 | return bh; |
66 | } | 71 | } |
@@ -356,7 +361,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
356 | if (root->info.hash_version != DX_HASH_TEA && | 361 | if (root->info.hash_version != DX_HASH_TEA && |
357 | root->info.hash_version != DX_HASH_HALF_MD4 && | 362 | root->info.hash_version != DX_HASH_HALF_MD4 && |
358 | root->info.hash_version != DX_HASH_LEGACY) { | 363 | root->info.hash_version != DX_HASH_LEGACY) { |
359 | ext3_warning(dir->i_sb, __FUNCTION__, | 364 | ext3_warning(dir->i_sb, __func__, |
360 | "Unrecognised inode hash code %d", | 365 | "Unrecognised inode hash code %d", |
361 | root->info.hash_version); | 366 | root->info.hash_version); |
362 | brelse(bh); | 367 | brelse(bh); |
@@ -370,7 +375,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
370 | hash = hinfo->hash; | 375 | hash = hinfo->hash; |
371 | 376 | ||
372 | if (root->info.unused_flags & 1) { | 377 | if (root->info.unused_flags & 1) { |
373 | ext3_warning(dir->i_sb, __FUNCTION__, | 378 | ext3_warning(dir->i_sb, __func__, |
374 | "Unimplemented inode hash flags: %#06x", | 379 | "Unimplemented inode hash flags: %#06x", |
375 | root->info.unused_flags); | 380 | root->info.unused_flags); |
376 | brelse(bh); | 381 | brelse(bh); |
@@ -379,7 +384,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
379 | } | 384 | } |
380 | 385 | ||
381 | if ((indirect = root->info.indirect_levels) > 1) { | 386 | if ((indirect = root->info.indirect_levels) > 1) { |
382 | ext3_warning(dir->i_sb, __FUNCTION__, | 387 | ext3_warning(dir->i_sb, __func__, |
383 | "Unimplemented inode hash depth: %#06x", | 388 | "Unimplemented inode hash depth: %#06x", |
384 | root->info.indirect_levels); | 389 | root->info.indirect_levels); |
385 | brelse(bh); | 390 | brelse(bh); |
@@ -392,7 +397,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
392 | 397 | ||
393 | if (dx_get_limit(entries) != dx_root_limit(dir, | 398 | if (dx_get_limit(entries) != dx_root_limit(dir, |
394 | root->info.info_length)) { | 399 | root->info.info_length)) { |
395 | ext3_warning(dir->i_sb, __FUNCTION__, | 400 | ext3_warning(dir->i_sb, __func__, |
396 | "dx entry: limit != root limit"); | 401 | "dx entry: limit != root limit"); |
397 | brelse(bh); | 402 | brelse(bh); |
398 | *err = ERR_BAD_DX_DIR; | 403 | *err = ERR_BAD_DX_DIR; |
@@ -404,7 +409,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
404 | { | 409 | { |
405 | count = dx_get_count(entries); | 410 | count = dx_get_count(entries); |
406 | if (!count || count > dx_get_limit(entries)) { | 411 | if (!count || count > dx_get_limit(entries)) { |
407 | ext3_warning(dir->i_sb, __FUNCTION__, | 412 | ext3_warning(dir->i_sb, __func__, |
408 | "dx entry: no count or count > limit"); | 413 | "dx entry: no count or count > limit"); |
409 | brelse(bh); | 414 | brelse(bh); |
410 | *err = ERR_BAD_DX_DIR; | 415 | *err = ERR_BAD_DX_DIR; |
@@ -449,7 +454,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
449 | goto fail2; | 454 | goto fail2; |
450 | at = entries = ((struct dx_node *) bh->b_data)->entries; | 455 | at = entries = ((struct dx_node *) bh->b_data)->entries; |
451 | if (dx_get_limit(entries) != dx_node_limit (dir)) { | 456 | if (dx_get_limit(entries) != dx_node_limit (dir)) { |
452 | ext3_warning(dir->i_sb, __FUNCTION__, | 457 | ext3_warning(dir->i_sb, __func__, |
453 | "dx entry: limit != node limit"); | 458 | "dx entry: limit != node limit"); |
454 | brelse(bh); | 459 | brelse(bh); |
455 | *err = ERR_BAD_DX_DIR; | 460 | *err = ERR_BAD_DX_DIR; |
@@ -465,7 +470,7 @@ fail2: | |||
465 | } | 470 | } |
466 | fail: | 471 | fail: |
467 | if (*err == ERR_BAD_DX_DIR) | 472 | if (*err == ERR_BAD_DX_DIR) |
468 | ext3_warning(dir->i_sb, __FUNCTION__, | 473 | ext3_warning(dir->i_sb, __func__, |
469 | "Corrupt dir inode %ld, running e2fsck is " | 474 | "Corrupt dir inode %ld, running e2fsck is " |
470 | "recommended.", dir->i_ino); | 475 | "recommended.", dir->i_ino); |
471 | return NULL; | 476 | return NULL; |
@@ -913,7 +918,7 @@ restart: | |||
913 | wait_on_buffer(bh); | 918 | wait_on_buffer(bh); |
914 | if (!buffer_uptodate(bh)) { | 919 | if (!buffer_uptodate(bh)) { |
915 | /* read error, skip block & hope for the best */ | 920 | /* read error, skip block & hope for the best */ |
916 | ext3_error(sb, __FUNCTION__, "reading directory #%lu " | 921 | ext3_error(sb, __func__, "reading directory #%lu " |
917 | "offset %lu", dir->i_ino, block); | 922 | "offset %lu", dir->i_ino, block); |
918 | brelse(bh); | 923 | brelse(bh); |
919 | goto next; | 924 | goto next; |
@@ -1005,7 +1010,7 @@ static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry, | |||
1005 | retval = ext3_htree_next_block(dir, hash, frame, | 1010 | retval = ext3_htree_next_block(dir, hash, frame, |
1006 | frames, NULL); | 1011 | frames, NULL); |
1007 | if (retval < 0) { | 1012 | if (retval < 0) { |
1008 | ext3_warning(sb, __FUNCTION__, | 1013 | ext3_warning(sb, __func__, |
1009 | "error reading index page in directory #%lu", | 1014 | "error reading index page in directory #%lu", |
1010 | dir->i_ino); | 1015 | dir->i_ino); |
1011 | *err = retval; | 1016 | *err = retval; |
@@ -1530,7 +1535,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, | |||
1530 | 1535 | ||
1531 | if (levels && (dx_get_count(frames->entries) == | 1536 | if (levels && (dx_get_count(frames->entries) == |
1532 | dx_get_limit(frames->entries))) { | 1537 | dx_get_limit(frames->entries))) { |
1533 | ext3_warning(sb, __FUNCTION__, | 1538 | ext3_warning(sb, __func__, |
1534 | "Directory index full!"); | 1539 | "Directory index full!"); |
1535 | err = -ENOSPC; | 1540 | err = -ENOSPC; |
1536 | goto cleanup; | 1541 | goto cleanup; |
@@ -1832,11 +1837,11 @@ static int empty_dir (struct inode * inode) | |||
1832 | if (inode->i_size < EXT3_DIR_REC_LEN(1) + EXT3_DIR_REC_LEN(2) || | 1837 | if (inode->i_size < EXT3_DIR_REC_LEN(1) + EXT3_DIR_REC_LEN(2) || |
1833 | !(bh = ext3_bread (NULL, inode, 0, 0, &err))) { | 1838 | !(bh = ext3_bread (NULL, inode, 0, 0, &err))) { |
1834 | if (err) | 1839 | if (err) |
1835 | ext3_error(inode->i_sb, __FUNCTION__, | 1840 | ext3_error(inode->i_sb, __func__, |
1836 | "error %d reading directory #%lu offset 0", | 1841 | "error %d reading directory #%lu offset 0", |
1837 | err, inode->i_ino); | 1842 | err, inode->i_ino); |
1838 | else | 1843 | else |
1839 | ext3_warning(inode->i_sb, __FUNCTION__, | 1844 | ext3_warning(inode->i_sb, __func__, |
1840 | "bad directory (dir #%lu) - no data block", | 1845 | "bad directory (dir #%lu) - no data block", |
1841 | inode->i_ino); | 1846 | inode->i_ino); |
1842 | return 1; | 1847 | return 1; |
@@ -1865,7 +1870,7 @@ static int empty_dir (struct inode * inode) | |||
1865 | offset >> EXT3_BLOCK_SIZE_BITS(sb), 0, &err); | 1870 | offset >> EXT3_BLOCK_SIZE_BITS(sb), 0, &err); |
1866 | if (!bh) { | 1871 | if (!bh) { |
1867 | if (err) | 1872 | if (err) |
1868 | ext3_error(sb, __FUNCTION__, | 1873 | ext3_error(sb, __func__, |
1869 | "error %d reading directory" | 1874 | "error %d reading directory" |
1870 | " #%lu offset %lu", | 1875 | " #%lu offset %lu", |
1871 | err, inode->i_ino, offset); | 1876 | err, inode->i_ino, offset); |
@@ -2318,6 +2323,8 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2318 | EXT3_FEATURE_INCOMPAT_FILETYPE)) | 2323 | EXT3_FEATURE_INCOMPAT_FILETYPE)) |
2319 | new_de->file_type = old_de->file_type; | 2324 | new_de->file_type = old_de->file_type; |
2320 | new_dir->i_version++; | 2325 | new_dir->i_version++; |
2326 | new_dir->i_ctime = new_dir->i_mtime = CURRENT_TIME_SEC; | ||
2327 | ext3_mark_inode_dirty(handle, new_dir); | ||
2321 | BUFFER_TRACE(new_bh, "call ext3_journal_dirty_metadata"); | 2328 | BUFFER_TRACE(new_bh, "call ext3_journal_dirty_metadata"); |
2322 | ext3_journal_dirty_metadata(handle, new_bh); | 2329 | ext3_journal_dirty_metadata(handle, new_bh); |
2323 | brelse(new_bh); | 2330 | brelse(new_bh); |