Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 bugfixes from Ted Ts'o:
"More bug fixes for ext4 -- most importantly, a fix for a bug
introduced in 3.15 that can end up triggering a file system corruption
error after a journal replay.

It shouldn't lead to any actual data corruption, but it is scary and
can force file systems to be remounted read-only, etc"

* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: fix potential null pointer dereference in ext4_free_inode
ext4: fix a potential deadlock in __ext4_es_shrink()
ext4: revert commit which was causing fs corruption after journal replays
ext4: disable synchronous transaction batching if max_batch_time==0
ext4: clarify ext4_error message in ext4_mb_generate_buddy_error()
ext4: clarify error count warning messages
ext4: fix unjournalled bg descriptor while initializing inode bitmap

+44 -45
+2 -2
fs/ext4/extents_status.c
··· 966 966 continue; 967 967 } 968 968 969 - if (ei->i_es_lru_nr == 0 || ei == locked_ei) 969 + if (ei->i_es_lru_nr == 0 || ei == locked_ei || 970 + !write_trylock(&ei->i_es_lock)) 970 971 continue; 971 972 972 - write_lock(&ei->i_es_lock); 973 973 shrunk = __es_try_to_reclaim_extents(ei, nr_to_scan); 974 974 if (ei->i_es_lru_nr == 0) 975 975 list_del_init(&ei->i_es_lru);
+8 -8
fs/ext4/ialloc.c
··· 338 338 fatal = err; 339 339 } else { 340 340 ext4_error(sb, "bit already cleared for inode %lu", ino); 341 - if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { 341 + if (gdp && !EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { 342 342 int count; 343 343 count = ext4_free_inodes_count(sb, gdp); 344 344 percpu_counter_sub(&sbi->s_freeinodes_counter, ··· 874 874 goto out; 875 875 } 876 876 877 + BUFFER_TRACE(group_desc_bh, "get_write_access"); 878 + err = ext4_journal_get_write_access(handle, group_desc_bh); 879 + if (err) { 880 + ext4_std_error(sb, err); 881 + goto out; 882 + } 883 + 877 884 /* We may have to initialize the block bitmap if it isn't already */ 878 885 if (ext4_has_group_desc_csum(sb) && 879 886 gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { ··· 915 908 ext4_std_error(sb, err); 916 909 goto out; 917 910 } 918 - } 919 - 920 - BUFFER_TRACE(group_desc_bh, "get_write_access"); 921 - err = ext4_journal_get_write_access(handle, group_desc_bh); 922 - if (err) { 923 - ext4_std_error(sb, err); 924 - goto out; 925 911 } 926 912 927 913 /* Update the relevant bg descriptor fields */
+2 -2
fs/ext4/mballoc.c
··· 752 752 753 753 if (free != grp->bb_free) { 754 754 ext4_grp_locked_error(sb, group, 0, 0, 755 - "%u clusters in bitmap, %u in gd; " 756 - "block bitmap corrupt.", 755 + "block bitmap and bg descriptor " 756 + "inconsistent: %u vs %u free clusters", 757 757 free, grp->bb_free); 758 758 /* 759 759 * If we intend to continue, we consider group descriptor
+28 -32
fs/ext4/super.c
··· 1525 1525 arg = JBD2_DEFAULT_MAX_COMMIT_AGE; 1526 1526 sbi->s_commit_interval = HZ * arg; 1527 1527 } else if (token == Opt_max_batch_time) { 1528 - if (arg == 0) 1529 - arg = EXT4_DEF_MAX_BATCH_TIME; 1530 1528 sbi->s_max_batch_time = arg; 1531 1529 } else if (token == Opt_min_batch_time) { 1532 1530 sbi->s_min_batch_time = arg; ··· 2807 2809 es = sbi->s_es; 2808 2810 2809 2811 if (es->s_error_count) 2810 - ext4_msg(sb, KERN_NOTICE, "error count: %u", 2812 + /* fsck newer than v1.41.13 is needed to clean this condition. */ 2813 + ext4_msg(sb, KERN_NOTICE, "error count since last fsck: %u", 2811 2814 le32_to_cpu(es->s_error_count)); 2812 2815 if (es->s_first_error_time) { 2813 - printk(KERN_NOTICE "EXT4-fs (%s): initial error at %u: %.*s:%d", 2816 + printk(KERN_NOTICE "EXT4-fs (%s): initial error at time %u: %.*s:%d", 2814 2817 sb->s_id, le32_to_cpu(es->s_first_error_time), 2815 2818 (int) sizeof(es->s_first_error_func), 2816 2819 es->s_first_error_func, ··· 2825 2826 printk("\n"); 2826 2827 } 2827 2828 if (es->s_last_error_time) { 2828 - printk(KERN_NOTICE "EXT4-fs (%s): last error at %u: %.*s:%d", 2829 + printk(KERN_NOTICE "EXT4-fs (%s): last error at time %u: %.*s:%d", 2829 2830 sb->s_id, le32_to_cpu(es->s_last_error_time), 2830 2831 (int) sizeof(es->s_last_error_func), 2831 2832 es->s_last_error_func, ··· 3879 3880 goto failed_mount2; 3880 3881 } 3881 3882 } 3882 - 3883 - /* 3884 - * set up enough so that it can read an inode, 3885 - * and create new inode for buddy allocator 3886 - */ 3887 - sbi->s_gdb_count = db_count; 3888 - if (!test_opt(sb, NOLOAD) && 3889 - EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) 3890 - sb->s_op = &ext4_sops; 3891 - else 3892 - sb->s_op = &ext4_nojournal_sops; 3893 - 3894 - ext4_ext_init(sb); 3895 - err = ext4_mb_init(sb); 3896 - if (err) { 3897 - ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", 3898 - err); 3899 - goto failed_mount2; 3900 - } 3901 - 3902 3883 if (!ext4_check_descriptors(sb, &first_not_zeroed)) { 3903 3884 ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); 3904 - goto failed_mount2a; 3885 + goto failed_mount2; 3905 3886 } 3906 3887 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) 3907 3888 if (!ext4_fill_flex_info(sb)) { 3908 3889 ext4_msg(sb, KERN_ERR, 3909 3890 "unable to initialize " 3910 3891 "flex_bg meta info!"); 3911 - goto failed_mount2a; 3892 + goto failed_mount2; 3912 3893 } 3913 3894 3895 + sbi->s_gdb_count = db_count; 3914 3896 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 3915 3897 spin_lock_init(&sbi->s_next_gen_lock); 3916 3898 ··· 3926 3946 sbi->s_stripe = ext4_get_stripe_size(sbi); 3927 3947 sbi->s_extent_max_zeroout_kb = 32; 3928 3948 3949 + /* 3950 + * set up enough so that it can read an inode 3951 + */ 3952 + if (!test_opt(sb, NOLOAD) && 3953 + EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) 3954 + sb->s_op = &ext4_sops; 3955 + else 3956 + sb->s_op = &ext4_nojournal_sops; 3929 3957 sb->s_export_op = &ext4_export_ops; 3930 3958 sb->s_xattr = ext4_xattr_handlers; 3931 3959 #ifdef CONFIG_QUOTA ··· 4123 4135 if (err) { 4124 4136 ext4_msg(sb, KERN_ERR, "failed to reserve %llu clusters for " 4125 4137 "reserved pool", ext4_calculate_resv_clusters(sb)); 4126 - goto failed_mount5; 4138 + goto failed_mount4a; 4127 4139 } 4128 4140 4129 4141 err = ext4_setup_system_zone(sb); 4130 4142 if (err) { 4131 4143 ext4_msg(sb, KERN_ERR, "failed to initialize system " 4132 4144 "zone (%d)", err); 4145 + goto failed_mount4a; 4146 + } 4147 + 4148 + ext4_ext_init(sb); 4149 + err = ext4_mb_init(sb); 4150 + if (err) { 4151 + ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", 4152 + err); 4133 4153 goto failed_mount5; 4134 4154 } 4135 4155 ··· 4214 4218 failed_mount7: 4215 4219 ext4_unregister_li_request(sb); 4216 4220 failed_mount6: 4217 - ext4_release_system_zone(sb); 4221 + ext4_mb_release(sb); 4218 4222 failed_mount5: 4223 + ext4_ext_release(sb); 4224 + ext4_release_system_zone(sb); 4225 + failed_mount4a: 4219 4226 dput(sb->s_root); 4220 4227 sb->s_root = NULL; 4221 4228 failed_mount4: ··· 4242 4243 percpu_counter_destroy(&sbi->s_extent_cache_cnt); 4243 4244 if (sbi->s_mmp_tsk) 4244 4245 kthread_stop(sbi->s_mmp_tsk); 4245 - failed_mount2a: 4246 - ext4_mb_release(sb); 4247 4246 failed_mount2: 4248 4247 for (i = 0; i < db_count; i++) 4249 4248 brelse(sbi->s_group_desc[i]); 4250 4249 ext4_kvfree(sbi->s_group_desc); 4251 4250 failed_mount: 4252 - ext4_ext_release(sb); 4253 4251 if (sbi->s_chksum_driver) 4254 4252 crypto_free_shash(sbi->s_chksum_driver); 4255 4253 if (sbi->s_proc) {
+4 -1
fs/jbd2/transaction.c
··· 1588 1588 * to perform a synchronous write. We do this to detect the 1589 1589 * case where a single process is doing a stream of sync 1590 1590 * writes. No point in waiting for joiners in that case. 1591 + * 1592 + * Setting max_batch_time to 0 disables this completely. 1591 1593 */ 1592 1594 pid = current->pid; 1593 - if (handle->h_sync && journal->j_last_sync_writer != pid) { 1595 + if (handle->h_sync && journal->j_last_sync_writer != pid && 1596 + journal->j_max_batch_time) { 1594 1597 u64 commit_time, trans_time; 1595 1598 1596 1599 journal->j_last_sync_writer = pid;