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 fixes from Ted Ts'o:
"Miscellaneous ext4 bug fixes (all stable fodder)"

* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: improve explanation of a mount failure caused by a misconfigured kernel
jbd2: do not clear the BH_Mapped flag when forgetting a metadata buffer
jbd2: move the clearing of b_modified flag to the journal_unmap_buffer()
ext4: add cond_resched() to ext4_protect_reserved_inode
ext4: fix checksum errors with indexed dirs
ext4: fix support for inode sizes > 1024 bytes
ext4: simplify checking quota limits in ext4_statfs()
ext4: don't assume that mmp_nodename/bdevname have NUL

+86 -63
+1
fs/ext4/block_validity.c
··· 207 207 return PTR_ERR(inode); 208 208 num = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; 209 209 while (i < num) { 210 + cond_resched(); 210 211 map.m_lblk = i; 211 212 map.m_len = num - i; 212 213 n = ext4_map_blocks(NULL, inode, &map, 0);
+8 -6
fs/ext4/dir.c
··· 129 129 if (err != ERR_BAD_DX_DIR) { 130 130 return err; 131 131 } 132 - /* 133 - * We don't set the inode dirty flag since it's not 134 - * critical that it get flushed back to the disk. 135 - */ 136 - ext4_clear_inode_flag(file_inode(file), 137 - EXT4_INODE_INDEX); 132 + /* Can we just clear INDEX flag to ignore htree information? */ 133 + if (!ext4_has_metadata_csum(sb)) { 134 + /* 135 + * We don't set the inode dirty flag since it's not 136 + * critical that it gets flushed back to the disk. 137 + */ 138 + ext4_clear_inode_flag(inode, EXT4_INODE_INDEX); 139 + } 138 140 } 139 141 140 142 if (ext4_has_inline_data(inode)) {
+4 -1
fs/ext4/ext4.h
··· 2544 2544 struct ext4_filename *fname); 2545 2545 static inline void ext4_update_dx_flag(struct inode *inode) 2546 2546 { 2547 - if (!ext4_has_feature_dir_index(inode->i_sb)) 2547 + if (!ext4_has_feature_dir_index(inode->i_sb)) { 2548 + /* ext4_iget() should have caught this... */ 2549 + WARN_ON_ONCE(ext4_has_feature_metadata_csum(inode->i_sb)); 2548 2550 ext4_clear_inode_flag(inode, EXT4_INODE_INDEX); 2551 + } 2549 2552 } 2550 2553 static const unsigned char ext4_filetype_table[] = { 2551 2554 DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, DT_BLK, DT_FIFO, DT_SOCK, DT_LNK
+12
fs/ext4/inode.c
··· 4644 4644 ret = -EFSCORRUPTED; 4645 4645 goto bad_inode; 4646 4646 } 4647 + /* 4648 + * If dir_index is not enabled but there's dir with INDEX flag set, 4649 + * we'd normally treat htree data as empty space. But with metadata 4650 + * checksumming that corrupts checksums so forbid that. 4651 + */ 4652 + if (!ext4_has_feature_dir_index(sb) && ext4_has_metadata_csum(sb) && 4653 + ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) { 4654 + ext4_error_inode(inode, function, line, 0, 4655 + "iget: Dir with htree data on filesystem without dir_index feature."); 4656 + ret = -EFSCORRUPTED; 4657 + goto bad_inode; 4658 + } 4647 4659 ei->i_disksize = inode->i_size; 4648 4660 #ifdef CONFIG_QUOTA 4649 4661 ei->i_reserved_quota = 0;
+7 -5
fs/ext4/mmp.c
··· 120 120 { 121 121 __ext4_warning(sb, function, line, "%s", msg); 122 122 __ext4_warning(sb, function, line, 123 - "MMP failure info: last update time: %llu, last update " 124 - "node: %s, last update device: %s", 125 - (long long unsigned int) le64_to_cpu(mmp->mmp_time), 126 - mmp->mmp_nodename, mmp->mmp_bdevname); 123 + "MMP failure info: last update time: %llu, last update node: %.*s, last update device: %.*s", 124 + (unsigned long long)le64_to_cpu(mmp->mmp_time), 125 + (int)sizeof(mmp->mmp_nodename), mmp->mmp_nodename, 126 + (int)sizeof(mmp->mmp_bdevname), mmp->mmp_bdevname); 127 127 } 128 128 129 129 /* ··· 154 154 mmp_check_interval = max(EXT4_MMP_CHECK_MULT * mmp_update_interval, 155 155 EXT4_MMP_MIN_CHECK_INTERVAL); 156 156 mmp->mmp_check_interval = cpu_to_le16(mmp_check_interval); 157 + BUILD_BUG_ON(sizeof(mmp->mmp_bdevname) < BDEVNAME_SIZE); 157 158 bdevname(bh->b_bdev, mmp->mmp_bdevname); 158 159 159 160 memcpy(mmp->mmp_nodename, init_utsname()->nodename, ··· 380 379 /* 381 380 * Start a kernel thread to update the MMP block periodically. 382 381 */ 383 - EXT4_SB(sb)->s_mmp_tsk = kthread_run(kmmpd, mmpd_data, "kmmpd-%s", 382 + EXT4_SB(sb)->s_mmp_tsk = kthread_run(kmmpd, mmpd_data, "kmmpd-%.*s", 383 + (int)sizeof(mmp->mmp_bdevname), 384 384 bdevname(bh->b_bdev, 385 385 mmp->mmp_bdevname)); 386 386 if (IS_ERR(EXT4_SB(sb)->s_mmp_tsk)) {
+7
fs/ext4/namei.c
··· 2213 2213 retval = ext4_dx_add_entry(handle, &fname, dir, inode); 2214 2214 if (!retval || (retval != ERR_BAD_DX_DIR)) 2215 2215 goto out; 2216 + /* Can we just ignore htree data? */ 2217 + if (ext4_has_metadata_csum(sb)) { 2218 + EXT4_ERROR_INODE(dir, 2219 + "Directory has corrupted htree index."); 2220 + retval = -EFSCORRUPTED; 2221 + goto out; 2222 + } 2216 2223 ext4_clear_inode_flag(dir, EXT4_INODE_INDEX); 2217 2224 dx_fallback++; 2218 2225 ext4_mark_inode_dirty(handle, dir);
+16 -26
fs/ext4/super.c
··· 3009 3009 return 0; 3010 3010 } 3011 3011 3012 - #ifndef CONFIG_QUOTA 3013 - if (ext4_has_feature_quota(sb) && !readonly) { 3012 + #if !defined(CONFIG_QUOTA) || !defined(CONFIG_QFMT_V2) 3013 + if (!readonly && (ext4_has_feature_quota(sb) || 3014 + ext4_has_feature_project(sb))) { 3014 3015 ext4_msg(sb, KERN_ERR, 3015 - "Filesystem with quota feature cannot be mounted RDWR " 3016 - "without CONFIG_QUOTA"); 3017 - return 0; 3018 - } 3019 - if (ext4_has_feature_project(sb) && !readonly) { 3020 - ext4_msg(sb, KERN_ERR, 3021 - "Filesystem with project quota feature cannot be mounted RDWR " 3022 - "without CONFIG_QUOTA"); 3016 + "The kernel was not built with CONFIG_QUOTA and CONFIG_QFMT_V2"); 3023 3017 return 0; 3024 3018 } 3025 3019 #endif /* CONFIG_QUOTA */ ··· 3808 3814 */ 3809 3815 sbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT; 3810 3816 3817 + blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); 3818 + if (blocksize < EXT4_MIN_BLOCK_SIZE || 3819 + blocksize > EXT4_MAX_BLOCK_SIZE) { 3820 + ext4_msg(sb, KERN_ERR, 3821 + "Unsupported filesystem blocksize %d (%d log_block_size)", 3822 + blocksize, le32_to_cpu(es->s_log_block_size)); 3823 + goto failed_mount; 3824 + } 3825 + 3811 3826 if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV) { 3812 3827 sbi->s_inode_size = EXT4_GOOD_OLD_INODE_SIZE; 3813 3828 sbi->s_first_ino = EXT4_GOOD_OLD_FIRST_INO; ··· 3834 3831 ext4_msg(sb, KERN_ERR, 3835 3832 "unsupported inode size: %d", 3836 3833 sbi->s_inode_size); 3834 + ext4_msg(sb, KERN_ERR, "blocksize: %d", blocksize); 3837 3835 goto failed_mount; 3838 3836 } 3839 3837 /* ··· 4037 4033 if (!ext4_feature_set_ok(sb, (sb_rdonly(sb)))) 4038 4034 goto failed_mount; 4039 4035 4040 - blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); 4041 - if (blocksize < EXT4_MIN_BLOCK_SIZE || 4042 - blocksize > EXT4_MAX_BLOCK_SIZE) { 4043 - ext4_msg(sb, KERN_ERR, 4044 - "Unsupported filesystem blocksize %d (%d log_block_size)", 4045 - blocksize, le32_to_cpu(es->s_log_block_size)); 4046 - goto failed_mount; 4047 - } 4048 4036 if (le32_to_cpu(es->s_log_block_size) > 4049 4037 (EXT4_MAX_BLOCK_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) { 4050 4038 ext4_msg(sb, KERN_ERR, ··· 5581 5585 return PTR_ERR(dquot); 5582 5586 spin_lock(&dquot->dq_dqb_lock); 5583 5587 5584 - limit = 0; 5585 - if (dquot->dq_dqb.dqb_bsoftlimit && 5586 - (!limit || dquot->dq_dqb.dqb_bsoftlimit < limit)) 5587 - limit = dquot->dq_dqb.dqb_bsoftlimit; 5588 + limit = dquot->dq_dqb.dqb_bsoftlimit; 5588 5589 if (dquot->dq_dqb.dqb_bhardlimit && 5589 5590 (!limit || dquot->dq_dqb.dqb_bhardlimit < limit)) 5590 5591 limit = dquot->dq_dqb.dqb_bhardlimit; ··· 5596 5603 (buf->f_blocks - curblock) : 0; 5597 5604 } 5598 5605 5599 - limit = 0; 5600 - if (dquot->dq_dqb.dqb_isoftlimit && 5601 - (!limit || dquot->dq_dqb.dqb_isoftlimit < limit)) 5602 - limit = dquot->dq_dqb.dqb_isoftlimit; 5606 + limit = dquot->dq_dqb.dqb_isoftlimit; 5603 5607 if (dquot->dq_dqb.dqb_ihardlimit && 5604 5608 (!limit || dquot->dq_dqb.dqb_ihardlimit < limit)) 5605 5609 limit = dquot->dq_dqb.dqb_ihardlimit;
+25 -21
fs/jbd2/commit.c
··· 976 976 * it. */ 977 977 978 978 /* 979 - * A buffer which has been freed while still being journaled by 980 - * a previous transaction. 981 - */ 982 - if (buffer_freed(bh)) { 979 + * A buffer which has been freed while still being journaled 980 + * by a previous transaction, refile the buffer to BJ_Forget of 981 + * the running transaction. If the just committed transaction 982 + * contains "add to orphan" operation, we can completely 983 + * invalidate the buffer now. We are rather through in that 984 + * since the buffer may be still accessible when blocksize < 985 + * pagesize and it is attached to the last partial page. 986 + */ 987 + if (buffer_freed(bh) && !jh->b_next_transaction) { 988 + struct address_space *mapping; 989 + 990 + clear_buffer_freed(bh); 991 + clear_buffer_jbddirty(bh); 992 + 983 993 /* 984 - * If the running transaction is the one containing 985 - * "add to orphan" operation (b_next_transaction != 986 - * NULL), we have to wait for that transaction to 987 - * commit before we can really get rid of the buffer. 988 - * So just clear b_modified to not confuse transaction 989 - * credit accounting and refile the buffer to 990 - * BJ_Forget of the running transaction. If the just 991 - * committed transaction contains "add to orphan" 992 - * operation, we can completely invalidate the buffer 993 - * now. We are rather through in that since the 994 - * buffer may be still accessible when blocksize < 995 - * pagesize and it is attached to the last partial 996 - * page. 994 + * Block device buffers need to stay mapped all the 995 + * time, so it is enough to clear buffer_jbddirty and 996 + * buffer_freed bits. For the file mapping buffers (i.e. 997 + * journalled data) we need to unmap buffer and clear 998 + * more bits. We also need to be careful about the check 999 + * because the data page mapping can get cleared under 1000 + * out hands, which alse need not to clear more bits 1001 + * because the page and buffers will be freed and can 1002 + * never be reused once we are done with them. 997 1003 */ 998 - jh->b_modified = 0; 999 - if (!jh->b_next_transaction) { 1000 - clear_buffer_freed(bh); 1001 - clear_buffer_jbddirty(bh); 1004 + mapping = READ_ONCE(bh->b_page->mapping); 1005 + if (mapping && !sb_is_blkdev_sb(mapping->host->i_sb)) { 1002 1006 clear_buffer_mapped(bh); 1003 1007 clear_buffer_new(bh); 1004 1008 clear_buffer_req(bh);
+6 -4
fs/jbd2/transaction.c
··· 2329 2329 return -EBUSY; 2330 2330 } 2331 2331 /* 2332 - * OK, buffer won't be reachable after truncate. We just set 2333 - * j_next_transaction to the running transaction (if there is 2334 - * one) and mark buffer as freed so that commit code knows it 2335 - * should clear dirty bits when it is done with the buffer. 2332 + * OK, buffer won't be reachable after truncate. We just clear 2333 + * b_modified to not confuse transaction credit accounting, and 2334 + * set j_next_transaction to the running transaction (if there 2335 + * is one) and mark buffer as freed so that commit code knows 2336 + * it should clear dirty bits when it is done with the buffer. 2336 2337 */ 2337 2338 set_buffer_freed(bh); 2338 2339 if (journal->j_running_transaction && buffer_jbddirty(bh)) 2339 2340 jh->b_next_transaction = journal->j_running_transaction; 2341 + jh->b_modified = 0; 2340 2342 spin_unlock(&journal->j_list_lock); 2341 2343 spin_unlock(&jh->b_state_lock); 2342 2344 write_unlock(&journal->j_state_lock);