From: Greg Kroah-Hartman Date: Mon, 14 Jul 2014 18:24:49 +0000 (-0700) Subject: 3.15-stable patches X-Git-Tag: v3.4.99~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a64284fcd95d1184ad88d57243666cf9201f58d8;p=thirdparty%2Fkernel%2Fstable-queue.git 3.15-stable patches added patches: ext4-clarify-error-count-warning-messages.patch ext4-clarify-ext4_error-message-in-ext4_mb_generate_buddy_error.patch ext4-disable-synchronous-transaction-batching-if-max_batch_time-0.patch ext4-fix-a-potential-deadlock-in-__ext4_es_shrink.patch ext4-fix-unjournalled-bg-descriptor-while-initializing-inode-bitmap.patch ext4-revert-commit-which-was-causing-fs-corruption-after-journal-replays.patch --- diff --git a/queue-3.15/ext4-clarify-error-count-warning-messages.patch b/queue-3.15/ext4-clarify-error-count-warning-messages.patch new file mode 100644 index 00000000000..a554e50afa1 --- /dev/null +++ b/queue-3.15/ext4-clarify-error-count-warning-messages.patch @@ -0,0 +1,46 @@ +From ae0f78de2c43b6fadd007c231a352b13b5be8ed2 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sat, 5 Jul 2014 18:40:52 -0400 +Subject: ext4: clarify error count warning messages + +From: Theodore Ts'o + +commit ae0f78de2c43b6fadd007c231a352b13b5be8ed2 upstream. + +Make it clear that values printed are times, and that it is error +since last fsck. Also add note about fsck version required. + +Signed-off-by: Pavel Machek +Signed-off-by: Theodore Ts'o +Reviewed-by: Andreas Dilger +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/super.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -2798,10 +2798,11 @@ static void print_daily_error_info(unsig + es = sbi->s_es; + + if (es->s_error_count) +- ext4_msg(sb, KERN_NOTICE, "error count: %u", ++ /* fsck newer than v1.41.13 is needed to clean this condition. */ ++ ext4_msg(sb, KERN_NOTICE, "error count since last fsck: %u", + le32_to_cpu(es->s_error_count)); + if (es->s_first_error_time) { +- printk(KERN_NOTICE "EXT4-fs (%s): initial error at %u: %.*s:%d", ++ printk(KERN_NOTICE "EXT4-fs (%s): initial error at time %u: %.*s:%d", + sb->s_id, le32_to_cpu(es->s_first_error_time), + (int) sizeof(es->s_first_error_func), + es->s_first_error_func, +@@ -2815,7 +2816,7 @@ static void print_daily_error_info(unsig + printk("\n"); + } + if (es->s_last_error_time) { +- printk(KERN_NOTICE "EXT4-fs (%s): last error at %u: %.*s:%d", ++ printk(KERN_NOTICE "EXT4-fs (%s): last error at time %u: %.*s:%d", + sb->s_id, le32_to_cpu(es->s_last_error_time), + (int) sizeof(es->s_last_error_func), + es->s_last_error_func, diff --git a/queue-3.15/ext4-clarify-ext4_error-message-in-ext4_mb_generate_buddy_error.patch b/queue-3.15/ext4-clarify-ext4_error-message-in-ext4_mb_generate_buddy_error.patch new file mode 100644 index 00000000000..1fa3d1f85bd --- /dev/null +++ b/queue-3.15/ext4-clarify-ext4_error-message-in-ext4_mb_generate_buddy_error.patch @@ -0,0 +1,32 @@ +From 94d4c066a4ff170a2671b1a9b153febbf36796f6 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sat, 5 Jul 2014 19:15:50 -0400 +Subject: ext4: clarify ext4_error message in ext4_mb_generate_buddy_error() + +From: Theodore Ts'o + +commit 94d4c066a4ff170a2671b1a9b153febbf36796f6 upstream. + +We are spending a lot of time explaining to users what this error +means. Let's try to improve the message to avoid this problem. + +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/mballoc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/ext4/mballoc.c ++++ b/fs/ext4/mballoc.c +@@ -751,8 +751,8 @@ void ext4_mb_generate_buddy(struct super + + if (free != grp->bb_free) { + ext4_grp_locked_error(sb, group, 0, 0, +- "%u clusters in bitmap, %u in gd; " +- "block bitmap corrupt.", ++ "block bitmap and bg descriptor " ++ "inconsistent: %u vs %u free clusters", + free, grp->bb_free); + /* + * If we intend to continue, we consider group descriptor diff --git a/queue-3.15/ext4-disable-synchronous-transaction-batching-if-max_batch_time-0.patch b/queue-3.15/ext4-disable-synchronous-transaction-batching-if-max_batch_time-0.patch new file mode 100644 index 00000000000..5253e943865 --- /dev/null +++ b/queue-3.15/ext4-disable-synchronous-transaction-batching-if-max_batch_time-0.patch @@ -0,0 +1,53 @@ +From 5dd214248f94d430d70e9230bda72f2654ac88a8 Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Sat, 5 Jul 2014 19:18:22 -0400 +Subject: ext4: disable synchronous transaction batching if max_batch_time==0 + +From: Eric Sandeen + +commit 5dd214248f94d430d70e9230bda72f2654ac88a8 upstream. + +The mount manpage says of the max_batch_time option, + + This optimization can be turned off entirely + by setting max_batch_time to 0. + +But the code doesn't do that. So fix the code to do +that. + +Signed-off-by: Eric Sandeen +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/super.c | 2 -- + fs/jbd2/transaction.c | 5 ++++- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -1524,8 +1524,6 @@ static int handle_mount_opt(struct super + arg = JBD2_DEFAULT_MAX_COMMIT_AGE; + sbi->s_commit_interval = HZ * arg; + } else if (token == Opt_max_batch_time) { +- if (arg == 0) +- arg = EXT4_DEF_MAX_BATCH_TIME; + sbi->s_max_batch_time = arg; + } else if (token == Opt_min_batch_time) { + sbi->s_min_batch_time = arg; +--- a/fs/jbd2/transaction.c ++++ b/fs/jbd2/transaction.c +@@ -1588,9 +1588,12 @@ int jbd2_journal_stop(handle_t *handle) + * to perform a synchronous write. We do this to detect the + * case where a single process is doing a stream of sync + * writes. No point in waiting for joiners in that case. ++ * ++ * Setting max_batch_time to 0 disables this completely. + */ + pid = current->pid; +- if (handle->h_sync && journal->j_last_sync_writer != pid) { ++ if (handle->h_sync && journal->j_last_sync_writer != pid && ++ journal->j_max_batch_time) { + u64 commit_time, trans_time; + + journal->j_last_sync_writer = pid; diff --git a/queue-3.15/ext4-fix-a-potential-deadlock-in-__ext4_es_shrink.patch b/queue-3.15/ext4-fix-a-potential-deadlock-in-__ext4_es_shrink.patch new file mode 100644 index 00000000000..5fede02699e --- /dev/null +++ b/queue-3.15/ext4-fix-a-potential-deadlock-in-__ext4_es_shrink.patch @@ -0,0 +1,92 @@ +From 3f1f9b851311a76226140b55b1ea22111234a7c2 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sat, 12 Jul 2014 15:32:24 -0400 +Subject: ext4: fix a potential deadlock in __ext4_es_shrink() + +From: Theodore Ts'o + +commit 3f1f9b851311a76226140b55b1ea22111234a7c2 upstream. + +This fixes the following lockdep complaint: + +[ INFO: possible circular locking dependency detected ] +3.16.0-rc2-mm1+ #7 Tainted: G O +------------------------------------------------------- +kworker/u24:0/4356 is trying to acquire lock: + (&(&sbi->s_es_lru_lock)->rlock){+.+.-.}, at: [] __ext4_es_shrink+0x4f/0x2e0 + +but task is already holding lock: + (&ei->i_es_lock){++++-.}, at: [] ext4_es_insert_extent+0x71/0x180 + +which lock already depends on the new lock. + + Possible unsafe locking scenario: + + CPU0 CPU1 + ---- ---- + lock(&ei->i_es_lock); + lock(&(&sbi->s_es_lru_lock)->rlock); + lock(&ei->i_es_lock); + lock(&(&sbi->s_es_lru_lock)->rlock); + + *** DEADLOCK *** + +6 locks held by kworker/u24:0/4356: + #0: ("writeback"){.+.+.+}, at: [] process_one_work+0x180/0x560 + #1: ((&(&wb->dwork)->work)){+.+.+.}, at: [] process_one_work+0x180/0x560 + #2: (&type->s_umount_key#22){++++++}, at: [] grab_super_passive+0x44/0x90 + #3: (jbd2_handle){+.+...}, at: [] start_this_handle+0x189/0x5f0 + #4: (&ei->i_data_sem){++++..}, at: [] ext4_map_blocks+0x132/0x550 + #5: (&ei->i_es_lock){++++-.}, at: [] ext4_es_insert_extent+0x71/0x180 + +stack backtrace: +CPU: 0 PID: 4356 Comm: kworker/u24:0 Tainted: G O 3.16.0-rc2-mm1+ #7 +Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 +Workqueue: writeback bdi_writeback_workfn (flush-253:0) + ffffffff8213dce0 ffff880014b07538 ffffffff815df0bb 0000000000000007 + ffffffff8213e040 ffff880014b07588 ffffffff815db3dd ffff880014b07568 + ffff880014b07610 ffff88003b868930 ffff88003b868908 ffff88003b868930 +Call Trace: + [] dump_stack+0x4e/0x68 + [] print_circular_bug+0x1fb/0x20c + [] __lock_acquire+0x163e/0x1d00 + [] ? retint_restore_args+0xe/0xe + [] ? __slab_alloc+0x4a8/0x4ce + [] ? __ext4_es_shrink+0x4f/0x2e0 + [] lock_acquire+0x87/0x120 + [] ? __ext4_es_shrink+0x4f/0x2e0 + [] ? ext4_es_free_extent+0x5d/0x70 + [] _raw_spin_lock+0x39/0x50 + [] ? __ext4_es_shrink+0x4f/0x2e0 + [] ? kmem_cache_alloc+0x18b/0x1a0 + [] __ext4_es_shrink+0x4f/0x2e0 + [] ext4_es_insert_extent+0xc8/0x180 + [] ext4_map_blocks+0x1c4/0x550 + [] ext4_writepages+0x6d4/0xd00 + ... + +Reported-by: Minchan Kim +Signed-off-by: Theodore Ts'o +Reported-by: Minchan Kim +Cc: Zheng Liu +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/extents_status.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/ext4/extents_status.c ++++ b/fs/ext4/extents_status.c +@@ -960,10 +960,10 @@ retry: + continue; + } + +- if (ei->i_es_lru_nr == 0 || ei == locked_ei) ++ if (ei->i_es_lru_nr == 0 || ei == locked_ei || ++ !write_trylock(&ei->i_es_lock)) + continue; + +- write_lock(&ei->i_es_lock); + shrunk = __es_try_to_reclaim_extents(ei, nr_to_scan); + if (ei->i_es_lru_nr == 0) + list_del_init(&ei->i_es_lru); diff --git a/queue-3.15/ext4-fix-unjournalled-bg-descriptor-while-initializing-inode-bitmap.patch b/queue-3.15/ext4-fix-unjournalled-bg-descriptor-while-initializing-inode-bitmap.patch new file mode 100644 index 00000000000..486c0ff4efe --- /dev/null +++ b/queue-3.15/ext4-fix-unjournalled-bg-descriptor-while-initializing-inode-bitmap.patch @@ -0,0 +1,54 @@ +From 61c219f5814277ecb71d64cb30297028d6665979 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sat, 5 Jul 2014 16:28:35 -0400 +Subject: ext4: fix unjournalled bg descriptor while initializing inode bitmap + +From: Theodore Ts'o + +commit 61c219f5814277ecb71d64cb30297028d6665979 upstream. + +The first time that we allocate from an uninitialized inode allocation +bitmap, if the block allocation bitmap is also uninitalized, we need +to get write access to the block group descriptor before we start +modifying the block group descriptor flags and updating the free block +count, etc. Otherwise, there is the potential of a bad journal +checksum (if journal checksums are enabled), and of the file system +becoming inconsistent if we crash at exactly the wrong time. + +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/ialloc.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/fs/ext4/ialloc.c ++++ b/fs/ext4/ialloc.c +@@ -851,6 +851,13 @@ got: + goto out; + } + ++ BUFFER_TRACE(group_desc_bh, "get_write_access"); ++ err = ext4_journal_get_write_access(handle, group_desc_bh); ++ if (err) { ++ ext4_std_error(sb, err); ++ goto out; ++ } ++ + /* We may have to initialize the block bitmap if it isn't already */ + if (ext4_has_group_desc_csum(sb) && + gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { +@@ -887,13 +894,6 @@ got: + } + } + +- BUFFER_TRACE(group_desc_bh, "get_write_access"); +- err = ext4_journal_get_write_access(handle, group_desc_bh); +- if (err) { +- ext4_std_error(sb, err); +- goto out; +- } +- + /* Update the relevant bg descriptor fields */ + if (ext4_has_group_desc_csum(sb)) { + int free; diff --git a/queue-3.15/ext4-revert-commit-which-was-causing-fs-corruption-after-journal-replays.patch b/queue-3.15/ext4-revert-commit-which-was-causing-fs-corruption-after-journal-replays.patch new file mode 100644 index 00000000000..4f906094d70 --- /dev/null +++ b/queue-3.15/ext4-revert-commit-which-was-causing-fs-corruption-after-journal-replays.patch @@ -0,0 +1,143 @@ +From f9ae9cf5d72b3926ca48ea60e15bdbb840f42372 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Fri, 11 Jul 2014 13:55:40 -0400 +Subject: ext4: revert commit which was causing fs corruption after journal replays + +From: Theodore Ts'o + +commit f9ae9cf5d72b3926ca48ea60e15bdbb840f42372 upstream. + +Commit 007649375f6af2 ("ext4: initialize multi-block allocator before +checking block descriptors") causes the block group descriptor's count +of the number of free blocks to become inconsistent with the number of +free blocks in the allocation bitmap. This is a harmless form of fs +corruption, but it causes the kernel to potentially remount the file +system read-only, or to panic, depending on the file systems's error +behavior. + +Thanks to Eric Whitney for his tireless work to reproduce and to find +the guilty commit. + +Fixes: 007649375f6af2 ("ext4: initialize multi-block allocator before checking block descriptors" + +Reported-by: David Jander +Reported-by: Matteo Croce +Tested-by: Eric Whitney +Suggested-by: Eric Whitney +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/super.c | 51 ++++++++++++++++++++++++--------------------------- + 1 file changed, 24 insertions(+), 27 deletions(-) + +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -3868,38 +3868,19 @@ static int ext4_fill_super(struct super_ + goto failed_mount2; + } + } +- +- /* +- * set up enough so that it can read an inode, +- * and create new inode for buddy allocator +- */ +- sbi->s_gdb_count = db_count; +- if (!test_opt(sb, NOLOAD) && +- EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) +- sb->s_op = &ext4_sops; +- else +- sb->s_op = &ext4_nojournal_sops; +- +- ext4_ext_init(sb); +- err = ext4_mb_init(sb); +- if (err) { +- ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", +- err); +- goto failed_mount2; +- } +- + if (!ext4_check_descriptors(sb, &first_not_zeroed)) { + ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); +- goto failed_mount2a; ++ goto failed_mount2; + } + if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) + if (!ext4_fill_flex_info(sb)) { + ext4_msg(sb, KERN_ERR, + "unable to initialize " + "flex_bg meta info!"); +- goto failed_mount2a; ++ goto failed_mount2; + } + ++ sbi->s_gdb_count = db_count; + get_random_bytes(&sbi->s_next_generation, sizeof(u32)); + spin_lock_init(&sbi->s_next_gen_lock); + +@@ -3934,6 +3915,14 @@ static int ext4_fill_super(struct super_ + sbi->s_stripe = ext4_get_stripe_size(sbi); + sbi->s_extent_max_zeroout_kb = 32; + ++ /* ++ * set up enough so that it can read an inode ++ */ ++ if (!test_opt(sb, NOLOAD) && ++ EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) ++ sb->s_op = &ext4_sops; ++ else ++ sb->s_op = &ext4_nojournal_sops; + sb->s_export_op = &ext4_export_ops; + sb->s_xattr = ext4_xattr_handlers; + #ifdef CONFIG_QUOTA +@@ -4123,13 +4112,21 @@ no_journal: + if (err) { + ext4_msg(sb, KERN_ERR, "failed to reserve %llu clusters for " + "reserved pool", ext4_calculate_resv_clusters(sb)); +- goto failed_mount5; ++ goto failed_mount4a; + } + + err = ext4_setup_system_zone(sb); + if (err) { + ext4_msg(sb, KERN_ERR, "failed to initialize system " + "zone (%d)", err); ++ goto failed_mount4a; ++ } ++ ++ ext4_ext_init(sb); ++ err = ext4_mb_init(sb); ++ if (err) { ++ ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", ++ err); + goto failed_mount5; + } + +@@ -4206,8 +4203,11 @@ failed_mount8: + failed_mount7: + ext4_unregister_li_request(sb); + failed_mount6: +- ext4_release_system_zone(sb); ++ ext4_mb_release(sb); + failed_mount5: ++ ext4_ext_release(sb); ++ ext4_release_system_zone(sb); ++failed_mount4a: + dput(sb->s_root); + sb->s_root = NULL; + failed_mount4: +@@ -4231,14 +4231,11 @@ failed_mount3: + percpu_counter_destroy(&sbi->s_extent_cache_cnt); + if (sbi->s_mmp_tsk) + kthread_stop(sbi->s_mmp_tsk); +-failed_mount2a: +- ext4_mb_release(sb); + failed_mount2: + for (i = 0; i < db_count; i++) + brelse(sbi->s_group_desc[i]); + ext4_kvfree(sbi->s_group_desc); + failed_mount: +- ext4_ext_release(sb); + if (sbi->s_chksum_driver) + crypto_free_shash(sbi->s_chksum_driver); + if (sbi->s_proc) { diff --git a/queue-3.15/series b/queue-3.15/series index 03c23473e2c..3ba0e0c510f 100644 --- a/queue-3.15/series +++ b/queue-3.15/series @@ -46,3 +46,9 @@ intel_pstate-don-t-touch-turbo-bit-if-turbo-disabled-or-unavailable.patch intel_pstate-update-documentation-of-max-min-_perf_pct-sysfs-files.patch intel_pstate-set-cpu-number-before-accessing-msrs.patch pci-fix-unaligned-access-in-af-transaction-pending-test.patch +ext4-fix-unjournalled-bg-descriptor-while-initializing-inode-bitmap.patch +ext4-clarify-error-count-warning-messages.patch +ext4-clarify-ext4_error-message-in-ext4_mb_generate_buddy_error.patch +ext4-disable-synchronous-transaction-batching-if-max_batch_time-0.patch +ext4-revert-commit-which-was-causing-fs-corruption-after-journal-replays.patch +ext4-fix-a-potential-deadlock-in-__ext4_es_shrink.patch