diff options
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 8175318abd84..fb5766e2bffe 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -2810,13 +2810,34 @@ static void ext4_commit_super(struct super_block *sb, | |||
2810 | 2810 | ||
2811 | if (!sbh) | 2811 | if (!sbh) |
2812 | return; | 2812 | return; |
2813 | if (buffer_write_io_error(sbh)) { | ||
2814 | /* | ||
2815 | * Oh, dear. A previous attempt to write the | ||
2816 | * superblock failed. This could happen because the | ||
2817 | * USB device was yanked out. Or it could happen to | ||
2818 | * be a transient write error and maybe the block will | ||
2819 | * be remapped. Nothing we can do but to retry the | ||
2820 | * write and hope for the best. | ||
2821 | */ | ||
2822 | printk(KERN_ERR "ext4: previous I/O error to " | ||
2823 | "superblock detected for %s.\n", sb->s_id); | ||
2824 | clear_buffer_write_io_error(sbh); | ||
2825 | set_buffer_uptodate(sbh); | ||
2826 | } | ||
2813 | es->s_wtime = cpu_to_le32(get_seconds()); | 2827 | es->s_wtime = cpu_to_le32(get_seconds()); |
2814 | ext4_free_blocks_count_set(es, ext4_count_free_blocks(sb)); | 2828 | ext4_free_blocks_count_set(es, ext4_count_free_blocks(sb)); |
2815 | es->s_free_inodes_count = cpu_to_le32(ext4_count_free_inodes(sb)); | 2829 | es->s_free_inodes_count = cpu_to_le32(ext4_count_free_inodes(sb)); |
2816 | BUFFER_TRACE(sbh, "marking dirty"); | 2830 | BUFFER_TRACE(sbh, "marking dirty"); |
2817 | mark_buffer_dirty(sbh); | 2831 | mark_buffer_dirty(sbh); |
2818 | if (sync) | 2832 | if (sync) { |
2819 | sync_dirty_buffer(sbh); | 2833 | sync_dirty_buffer(sbh); |
2834 | if (buffer_write_io_error(sbh)) { | ||
2835 | printk(KERN_ERR "ext4: I/O error while writing " | ||
2836 | "superblock for %s.\n", sb->s_id); | ||
2837 | clear_buffer_write_io_error(sbh); | ||
2838 | set_buffer_uptodate(sbh); | ||
2839 | } | ||
2840 | } | ||
2820 | } | 2841 | } |
2821 | 2842 | ||
2822 | 2843 | ||