diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-15 00:47:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-15 00:47:51 -0400 |
commit | 47188d39b5deeebf41f87a02af1b3935866364cf (patch) | |
tree | 4e7a5b4e7edfe1fd425695af0270315f2682f5a4 | |
parent | ad81f0545ef01ea651886dddac4bef6cec930092 (diff) | |
parent | e7676a704ee0a1ef71a6b23760b5a8f6896cb1a1 (diff) |
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 bugfixes from Ted Ts'o:
"Various regression and bug fixes for ext4"
* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: don't allow ext4_free_blocks() to fail due to ENOMEM
ext4: fix spelling errors and a comment in extent_status tree
ext4: rate limit printk in buffer_io_error()
ext4: don't show usrquota/grpquota twice in /proc/mounts
ext4: fix warning in ext4_evict_inode()
ext4: fix ext4_get_group_number()
ext4: silence warning in ext4_writepages()
-rw-r--r-- | fs/ext4/balloc.c | 4 | ||||
-rw-r--r-- | fs/ext4/extents_status.c | 22 | ||||
-rw-r--r-- | fs/ext4/inode.c | 12 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 11 | ||||
-rw-r--r-- | fs/ext4/page-io.c | 35 | ||||
-rw-r--r-- | fs/ext4/super.c | 14 |
6 files changed, 51 insertions, 47 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 58339393fa6e..ddd715e42a5c 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -38,8 +38,8 @@ ext4_group_t ext4_get_group_number(struct super_block *sb, | |||
38 | ext4_group_t group; | 38 | ext4_group_t group; |
39 | 39 | ||
40 | if (test_opt2(sb, STD_GROUP_SIZE)) | 40 | if (test_opt2(sb, STD_GROUP_SIZE)) |
41 | group = (le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) + | 41 | group = (block - |
42 | block) >> | 42 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) >> |
43 | (EXT4_BLOCK_SIZE_BITS(sb) + EXT4_CLUSTER_BITS(sb) + 3); | 43 | (EXT4_BLOCK_SIZE_BITS(sb) + EXT4_CLUSTER_BITS(sb) + 3); |
44 | else | 44 | else |
45 | ext4_get_group_no_and_offset(sb, block, &group, NULL); | 45 | ext4_get_group_no_and_offset(sb, block, &group, NULL); |
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c index ee018d5f397e..4b8df7fbb10a 100644 --- a/fs/ext4/extents_status.c +++ b/fs/ext4/extents_status.c | |||
@@ -439,7 +439,7 @@ static void ext4_es_insert_extent_ext_check(struct inode *inode, | |||
439 | */ | 439 | */ |
440 | if (!ext4_es_is_written(es) && !ext4_es_is_unwritten(es)) { | 440 | if (!ext4_es_is_written(es) && !ext4_es_is_unwritten(es)) { |
441 | if (in_range(es->es_lblk, ee_block, ee_len)) { | 441 | if (in_range(es->es_lblk, ee_block, ee_len)) { |
442 | pr_warn("ES insert assertation failed for " | 442 | pr_warn("ES insert assertion failed for " |
443 | "inode: %lu we can find an extent " | 443 | "inode: %lu we can find an extent " |
444 | "at block [%d/%d/%llu/%c], but we " | 444 | "at block [%d/%d/%llu/%c], but we " |
445 | "want to add an delayed/hole extent " | 445 | "want to add an delayed/hole extent " |
@@ -458,7 +458,7 @@ static void ext4_es_insert_extent_ext_check(struct inode *inode, | |||
458 | */ | 458 | */ |
459 | if (es->es_lblk < ee_block || | 459 | if (es->es_lblk < ee_block || |
460 | ext4_es_pblock(es) != ee_start + es->es_lblk - ee_block) { | 460 | ext4_es_pblock(es) != ee_start + es->es_lblk - ee_block) { |
461 | pr_warn("ES insert assertation failed for inode: %lu " | 461 | pr_warn("ES insert assertion failed for inode: %lu " |
462 | "ex_status [%d/%d/%llu/%c] != " | 462 | "ex_status [%d/%d/%llu/%c] != " |
463 | "es_status [%d/%d/%llu/%c]\n", inode->i_ino, | 463 | "es_status [%d/%d/%llu/%c]\n", inode->i_ino, |
464 | ee_block, ee_len, ee_start, | 464 | ee_block, ee_len, ee_start, |
@@ -468,7 +468,7 @@ static void ext4_es_insert_extent_ext_check(struct inode *inode, | |||
468 | } | 468 | } |
469 | 469 | ||
470 | if (ee_status ^ es_status) { | 470 | if (ee_status ^ es_status) { |
471 | pr_warn("ES insert assertation failed for inode: %lu " | 471 | pr_warn("ES insert assertion failed for inode: %lu " |
472 | "ex_status [%d/%d/%llu/%c] != " | 472 | "ex_status [%d/%d/%llu/%c] != " |
473 | "es_status [%d/%d/%llu/%c]\n", inode->i_ino, | 473 | "es_status [%d/%d/%llu/%c]\n", inode->i_ino, |
474 | ee_block, ee_len, ee_start, | 474 | ee_block, ee_len, ee_start, |
@@ -481,7 +481,7 @@ static void ext4_es_insert_extent_ext_check(struct inode *inode, | |||
481 | * that we don't want to add an written/unwritten extent. | 481 | * that we don't want to add an written/unwritten extent. |
482 | */ | 482 | */ |
483 | if (!ext4_es_is_delayed(es) && !ext4_es_is_hole(es)) { | 483 | if (!ext4_es_is_delayed(es) && !ext4_es_is_hole(es)) { |
484 | pr_warn("ES insert assertation failed for inode: %lu " | 484 | pr_warn("ES insert assertion failed for inode: %lu " |
485 | "can't find an extent at block %d but we want " | 485 | "can't find an extent at block %d but we want " |
486 | "to add an written/unwritten extent " | 486 | "to add an written/unwritten extent " |
487 | "[%d/%d/%llu/%llx]\n", inode->i_ino, | 487 | "[%d/%d/%llu/%llx]\n", inode->i_ino, |
@@ -519,7 +519,7 @@ static void ext4_es_insert_extent_ind_check(struct inode *inode, | |||
519 | * We want to add a delayed/hole extent but this | 519 | * We want to add a delayed/hole extent but this |
520 | * block has been allocated. | 520 | * block has been allocated. |
521 | */ | 521 | */ |
522 | pr_warn("ES insert assertation failed for inode: %lu " | 522 | pr_warn("ES insert assertion failed for inode: %lu " |
523 | "We can find blocks but we want to add a " | 523 | "We can find blocks but we want to add a " |
524 | "delayed/hole extent [%d/%d/%llu/%llx]\n", | 524 | "delayed/hole extent [%d/%d/%llu/%llx]\n", |
525 | inode->i_ino, es->es_lblk, es->es_len, | 525 | inode->i_ino, es->es_lblk, es->es_len, |
@@ -527,13 +527,13 @@ static void ext4_es_insert_extent_ind_check(struct inode *inode, | |||
527 | return; | 527 | return; |
528 | } else if (ext4_es_is_written(es)) { | 528 | } else if (ext4_es_is_written(es)) { |
529 | if (retval != es->es_len) { | 529 | if (retval != es->es_len) { |
530 | pr_warn("ES insert assertation failed for " | 530 | pr_warn("ES insert assertion failed for " |
531 | "inode: %lu retval %d != es_len %d\n", | 531 | "inode: %lu retval %d != es_len %d\n", |
532 | inode->i_ino, retval, es->es_len); | 532 | inode->i_ino, retval, es->es_len); |
533 | return; | 533 | return; |
534 | } | 534 | } |
535 | if (map.m_pblk != ext4_es_pblock(es)) { | 535 | if (map.m_pblk != ext4_es_pblock(es)) { |
536 | pr_warn("ES insert assertation failed for " | 536 | pr_warn("ES insert assertion failed for " |
537 | "inode: %lu m_pblk %llu != " | 537 | "inode: %lu m_pblk %llu != " |
538 | "es_pblk %llu\n", | 538 | "es_pblk %llu\n", |
539 | inode->i_ino, map.m_pblk, | 539 | inode->i_ino, map.m_pblk, |
@@ -549,7 +549,7 @@ static void ext4_es_insert_extent_ind_check(struct inode *inode, | |||
549 | } | 549 | } |
550 | } else if (retval == 0) { | 550 | } else if (retval == 0) { |
551 | if (ext4_es_is_written(es)) { | 551 | if (ext4_es_is_written(es)) { |
552 | pr_warn("ES insert assertation failed for inode: %lu " | 552 | pr_warn("ES insert assertion failed for inode: %lu " |
553 | "We can't find the block but we want to add " | 553 | "We can't find the block but we want to add " |
554 | "an written extent [%d/%d/%llu/%llx]\n", | 554 | "an written extent [%d/%d/%llu/%llx]\n", |
555 | inode->i_ino, es->es_lblk, es->es_len, | 555 | inode->i_ino, es->es_lblk, es->es_len, |
@@ -632,10 +632,8 @@ out: | |||
632 | } | 632 | } |
633 | 633 | ||
634 | /* | 634 | /* |
635 | * ext4_es_insert_extent() adds a space to a extent status tree. | 635 | * ext4_es_insert_extent() adds information to an inode's extent |
636 | * | 636 | * status tree. |
637 | * ext4_es_insert_extent is called by ext4_da_write_begin and | ||
638 | * ext4_es_remove_extent. | ||
639 | * | 637 | * |
640 | * Return 0 on success, error code on failure. | 638 | * Return 0 on success, error code on failure. |
641 | */ | 639 | */ |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0188e65e1f58..98b9bff92a8a 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -465,7 +465,7 @@ static void ext4_map_blocks_es_recheck(handle_t *handle, | |||
465 | if (es_map->m_lblk != map->m_lblk || | 465 | if (es_map->m_lblk != map->m_lblk || |
466 | es_map->m_flags != map->m_flags || | 466 | es_map->m_flags != map->m_flags || |
467 | es_map->m_pblk != map->m_pblk) { | 467 | es_map->m_pblk != map->m_pblk) { |
468 | printk("ES cache assertation failed for inode: %lu " | 468 | printk("ES cache assertion failed for inode: %lu " |
469 | "es_cached ex [%d/%d/%llu/%x] != " | 469 | "es_cached ex [%d/%d/%llu/%x] != " |
470 | "found ex [%d/%d/%llu/%x] retval %d flags %x\n", | 470 | "found ex [%d/%d/%llu/%x] retval %d flags %x\n", |
471 | inode->i_ino, es_map->m_lblk, es_map->m_len, | 471 | inode->i_ino, es_map->m_lblk, es_map->m_len, |
@@ -558,7 +558,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
558 | 558 | ||
559 | #ifdef ES_AGGRESSIVE_TEST | 559 | #ifdef ES_AGGRESSIVE_TEST |
560 | if (retval != map->m_len) { | 560 | if (retval != map->m_len) { |
561 | printk("ES len assertation failed for inode: %lu " | 561 | printk("ES len assertion failed for inode: %lu " |
562 | "retval %d != map->m_len %d " | 562 | "retval %d != map->m_len %d " |
563 | "in %s (lookup)\n", inode->i_ino, retval, | 563 | "in %s (lookup)\n", inode->i_ino, retval, |
564 | map->m_len, __func__); | 564 | map->m_len, __func__); |
@@ -659,7 +659,7 @@ found: | |||
659 | 659 | ||
660 | #ifdef ES_AGGRESSIVE_TEST | 660 | #ifdef ES_AGGRESSIVE_TEST |
661 | if (retval != map->m_len) { | 661 | if (retval != map->m_len) { |
662 | printk("ES len assertation failed for inode: %lu " | 662 | printk("ES len assertion failed for inode: %lu " |
663 | "retval %d != map->m_len %d " | 663 | "retval %d != map->m_len %d " |
664 | "in %s (allocation)\n", inode->i_ino, retval, | 664 | "in %s (allocation)\n", inode->i_ino, retval, |
665 | map->m_len, __func__); | 665 | map->m_len, __func__); |
@@ -1642,7 +1642,7 @@ add_delayed: | |||
1642 | 1642 | ||
1643 | #ifdef ES_AGGRESSIVE_TEST | 1643 | #ifdef ES_AGGRESSIVE_TEST |
1644 | if (retval != map->m_len) { | 1644 | if (retval != map->m_len) { |
1645 | printk("ES len assertation failed for inode: %lu " | 1645 | printk("ES len assertion failed for inode: %lu " |
1646 | "retval %d != map->m_len %d " | 1646 | "retval %d != map->m_len %d " |
1647 | "in %s (lookup)\n", inode->i_ino, retval, | 1647 | "in %s (lookup)\n", inode->i_ino, retval, |
1648 | map->m_len, __func__); | 1648 | map->m_len, __func__); |
@@ -2163,7 +2163,7 @@ static int mpage_map_and_submit_extent(handle_t *handle, | |||
2163 | 2163 | ||
2164 | mpd->io_submit.io_end->offset = | 2164 | mpd->io_submit.io_end->offset = |
2165 | ((loff_t)map->m_lblk) << inode->i_blkbits; | 2165 | ((loff_t)map->m_lblk) << inode->i_blkbits; |
2166 | while (map->m_len) { | 2166 | do { |
2167 | err = mpage_map_one_extent(handle, mpd); | 2167 | err = mpage_map_one_extent(handle, mpd); |
2168 | if (err < 0) { | 2168 | if (err < 0) { |
2169 | struct super_block *sb = inode->i_sb; | 2169 | struct super_block *sb = inode->i_sb; |
@@ -2201,7 +2201,7 @@ static int mpage_map_and_submit_extent(handle_t *handle, | |||
2201 | err = mpage_map_and_submit_buffers(mpd); | 2201 | err = mpage_map_and_submit_buffers(mpd); |
2202 | if (err < 0) | 2202 | if (err < 0) |
2203 | return err; | 2203 | return err; |
2204 | } | 2204 | } while (map->m_len); |
2205 | 2205 | ||
2206 | /* Update on-disk size after IO is submitted */ | 2206 | /* Update on-disk size after IO is submitted */ |
2207 | disksize = ((loff_t)mpd->first_page) << PAGE_CACHE_SHIFT; | 2207 | disksize = ((loff_t)mpd->first_page) << PAGE_CACHE_SHIFT; |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index a9ff5e5137ca..4bbbf13bd743 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -4740,11 +4740,16 @@ do_more: | |||
4740 | * blocks being freed are metadata. these blocks shouldn't | 4740 | * blocks being freed are metadata. these blocks shouldn't |
4741 | * be used until this transaction is committed | 4741 | * be used until this transaction is committed |
4742 | */ | 4742 | */ |
4743 | retry: | ||
4743 | new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS); | 4744 | new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS); |
4744 | if (!new_entry) { | 4745 | if (!new_entry) { |
4745 | ext4_mb_unload_buddy(&e4b); | 4746 | /* |
4746 | err = -ENOMEM; | 4747 | * We use a retry loop because |
4747 | goto error_return; | 4748 | * ext4_free_blocks() is not allowed to fail. |
4749 | */ | ||
4750 | cond_resched(); | ||
4751 | congestion_wait(BLK_RW_ASYNC, HZ/50); | ||
4752 | goto retry; | ||
4748 | } | 4753 | } |
4749 | new_entry->efd_start_cluster = bit; | 4754 | new_entry->efd_start_cluster = bit; |
4750 | new_entry->efd_group = block_group; | 4755 | new_entry->efd_group = block_group; |
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 48786cdb5e6c..6625d210fb45 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/ratelimit.h> | ||
28 | 29 | ||
29 | #include "ext4_jbd2.h" | 30 | #include "ext4_jbd2.h" |
30 | #include "xattr.h" | 31 | #include "xattr.h" |
@@ -55,7 +56,7 @@ void ext4_exit_pageio(void) | |||
55 | static void buffer_io_error(struct buffer_head *bh) | 56 | static void buffer_io_error(struct buffer_head *bh) |
56 | { | 57 | { |
57 | char b[BDEVNAME_SIZE]; | 58 | char b[BDEVNAME_SIZE]; |
58 | printk(KERN_ERR "Buffer I/O error on device %s, logical block %llu\n", | 59 | printk_ratelimited(KERN_ERR "Buffer I/O error on device %s, logical block %llu\n", |
59 | bdevname(bh->b_bdev, b), | 60 | bdevname(bh->b_bdev, b), |
60 | (unsigned long long)bh->b_blocknr); | 61 | (unsigned long long)bh->b_blocknr); |
61 | } | 62 | } |
@@ -308,6 +309,7 @@ ext4_io_end_t *ext4_get_io_end(ext4_io_end_t *io_end) | |||
308 | return io_end; | 309 | return io_end; |
309 | } | 310 | } |
310 | 311 | ||
312 | /* BIO completion function for page writeback */ | ||
311 | static void ext4_end_bio(struct bio *bio, int error) | 313 | static void ext4_end_bio(struct bio *bio, int error) |
312 | { | 314 | { |
313 | ext4_io_end_t *io_end = bio->bi_private; | 315 | ext4_io_end_t *io_end = bio->bi_private; |
@@ -318,18 +320,6 @@ static void ext4_end_bio(struct bio *bio, int error) | |||
318 | if (test_bit(BIO_UPTODATE, &bio->bi_flags)) | 320 | if (test_bit(BIO_UPTODATE, &bio->bi_flags)) |
319 | error = 0; | 321 | error = 0; |
320 | 322 | ||
321 | if (io_end->flag & EXT4_IO_END_UNWRITTEN) { | ||
322 | /* | ||
323 | * Link bio into list hanging from io_end. We have to do it | ||
324 | * atomically as bio completions can be racing against each | ||
325 | * other. | ||
326 | */ | ||
327 | bio->bi_private = xchg(&io_end->bio, bio); | ||
328 | } else { | ||
329 | ext4_finish_bio(bio); | ||
330 | bio_put(bio); | ||
331 | } | ||
332 | |||
333 | if (error) { | 323 | if (error) { |
334 | struct inode *inode = io_end->inode; | 324 | struct inode *inode = io_end->inode; |
335 | 325 | ||
@@ -341,7 +331,24 @@ static void ext4_end_bio(struct bio *bio, int error) | |||
341 | (unsigned long long) | 331 | (unsigned long long) |
342 | bi_sector >> (inode->i_blkbits - 9)); | 332 | bi_sector >> (inode->i_blkbits - 9)); |
343 | } | 333 | } |
344 | ext4_put_io_end_defer(io_end); | 334 | |
335 | if (io_end->flag & EXT4_IO_END_UNWRITTEN) { | ||
336 | /* | ||
337 | * Link bio into list hanging from io_end. We have to do it | ||
338 | * atomically as bio completions can be racing against each | ||
339 | * other. | ||
340 | */ | ||
341 | bio->bi_private = xchg(&io_end->bio, bio); | ||
342 | ext4_put_io_end_defer(io_end); | ||
343 | } else { | ||
344 | /* | ||
345 | * Drop io_end reference early. Inode can get freed once | ||
346 | * we finish the bio. | ||
347 | */ | ||
348 | ext4_put_io_end_defer(io_end); | ||
349 | ext4_finish_bio(bio); | ||
350 | bio_put(bio); | ||
351 | } | ||
345 | } | 352 | } |
346 | 353 | ||
347 | void ext4_io_submit(struct ext4_io_submit *io) | 354 | void ext4_io_submit(struct ext4_io_submit *io) |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 85b3dd60169b..bca26f34edf4 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1702,12 +1702,6 @@ static inline void ext4_show_quota_options(struct seq_file *seq, | |||
1702 | 1702 | ||
1703 | if (sbi->s_qf_names[GRPQUOTA]) | 1703 | if (sbi->s_qf_names[GRPQUOTA]) |
1704 | seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]); | 1704 | seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]); |
1705 | |||
1706 | if (test_opt(sb, USRQUOTA)) | ||
1707 | seq_puts(seq, ",usrquota"); | ||
1708 | |||
1709 | if (test_opt(sb, GRPQUOTA)) | ||
1710 | seq_puts(seq, ",grpquota"); | ||
1711 | #endif | 1705 | #endif |
1712 | } | 1706 | } |
1713 | 1707 | ||
@@ -3624,10 +3618,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3624 | sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb)); | 3618 | sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb)); |
3625 | sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb)); | 3619 | sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb)); |
3626 | 3620 | ||
3627 | /* Do we have standard group size of blocksize * 8 blocks ? */ | ||
3628 | if (sbi->s_blocks_per_group == blocksize << 3) | ||
3629 | set_opt2(sb, STD_GROUP_SIZE); | ||
3630 | |||
3631 | for (i = 0; i < 4; i++) | 3621 | for (i = 0; i < 4; i++) |
3632 | sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); | 3622 | sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); |
3633 | sbi->s_def_hash_version = es->s_def_hash_version; | 3623 | sbi->s_def_hash_version = es->s_def_hash_version; |
@@ -3697,6 +3687,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3697 | goto failed_mount; | 3687 | goto failed_mount; |
3698 | } | 3688 | } |
3699 | 3689 | ||
3690 | /* Do we have standard group size of clustersize * 8 blocks ? */ | ||
3691 | if (sbi->s_blocks_per_group == clustersize << 3) | ||
3692 | set_opt2(sb, STD_GROUP_SIZE); | ||
3693 | |||
3700 | /* | 3694 | /* |
3701 | * Test whether we have more sectors than will fit in sector_t, | 3695 | * Test whether we have more sectors than will fit in sector_t, |
3702 | * and whether the max offset is addressable by the page cache. | 3696 | * and whether the max offset is addressable by the page cache. |