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:
"A set of miscellaneous ext4 bug fixes for 3.18"

* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: make ext4_ext_convert_to_initialized() return proper number of blocks
ext4: bail early when clearing inode journal flag fails
ext4: bail out from make_indexed_dir() on first error
jbd2: use a better hash function for the revoke table
ext4: prevent bugon on race between write/fcntl
ext4: remove extent status procfs files if journal load fails
ext4: disallow changing journal_csum option during remount
ext4: enable journal checksum when metadata checksum feature enabled
ext4: fix oops when loading block bitmap failed
ext4: fix overflow when updating superblock backups after resize

+51 -28
+4 -5
fs/ext4/extents.c
··· 3603 3603 } 3604 3604 } 3605 3605 3606 - allocated = ext4_split_extent(handle, inode, ppath, 3607 - &split_map, split_flag, flags); 3608 - if (allocated < 0) 3609 - err = allocated; 3610 - 3606 + err = ext4_split_extent(handle, inode, ppath, &split_map, split_flag, 3607 + flags); 3608 + if (err > 0) 3609 + err = 0; 3611 3610 out: 3612 3611 /* If we have gotten a failure, don't zero out status tree */ 3613 3612 if (!err)
+1 -1
fs/ext4/file.c
··· 137 137 iov_iter_truncate(from, sbi->s_bitmap_maxbytes - pos); 138 138 } 139 139 140 + iocb->private = &overwrite; 140 141 if (o_direct) { 141 142 blk_start_plug(&plug); 142 143 143 - iocb->private = &overwrite; 144 144 145 145 /* check whether we do a DIO overwrite or not */ 146 146 if (ext4_should_dioread_nolock(inode) && !aio_mutex &&
+4
fs/ext4/ialloc.c
··· 887 887 struct buffer_head *block_bitmap_bh; 888 888 889 889 block_bitmap_bh = ext4_read_block_bitmap(sb, group); 890 + if (!block_bitmap_bh) { 891 + err = -EIO; 892 + goto out; 893 + } 890 894 BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); 891 895 err = ext4_journal_get_write_access(handle, block_bitmap_bh); 892 896 if (err) {
+6 -1
fs/ext4/inode.c
··· 4959 4959 if (val) 4960 4960 ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); 4961 4961 else { 4962 - jbd2_journal_flush(journal); 4962 + err = jbd2_journal_flush(journal); 4963 + if (err < 0) { 4964 + jbd2_journal_unlock_updates(journal); 4965 + ext4_inode_resume_unlocked_dio(inode); 4966 + return err; 4967 + } 4963 4968 ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); 4964 4969 } 4965 4970 ext4_set_aops(inode);
+18 -10
fs/ext4/namei.c
··· 1816 1816 hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned; 1817 1817 hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; 1818 1818 ext4fs_dirhash(name, namelen, &hinfo); 1819 + memset(frames, 0, sizeof(frames)); 1819 1820 frame = frames; 1820 1821 frame->entries = entries; 1821 1822 frame->at = entries; 1822 1823 frame->bh = bh; 1823 1824 bh = bh2; 1824 1825 1825 - ext4_handle_dirty_dx_node(handle, dir, frame->bh); 1826 - ext4_handle_dirty_dirent_node(handle, dir, bh); 1826 + retval = ext4_handle_dirty_dx_node(handle, dir, frame->bh); 1827 + if (retval) 1828 + goto out_frames; 1829 + retval = ext4_handle_dirty_dirent_node(handle, dir, bh); 1830 + if (retval) 1831 + goto out_frames; 1827 1832 1828 1833 de = do_split(handle,dir, &bh, frame, &hinfo); 1829 1834 if (IS_ERR(de)) { 1830 - /* 1831 - * Even if the block split failed, we have to properly write 1832 - * out all the changes we did so far. Otherwise we can end up 1833 - * with corrupted filesystem. 1834 - */ 1835 - ext4_mark_inode_dirty(handle, dir); 1836 - dx_release(frames); 1837 - return PTR_ERR(de); 1835 + retval = PTR_ERR(de); 1836 + goto out_frames; 1838 1837 } 1839 1838 dx_release(frames); 1840 1839 1841 1840 retval = add_dirent_to_buf(handle, dentry, inode, de, bh); 1842 1841 brelse(bh); 1842 + return retval; 1843 + out_frames: 1844 + /* 1845 + * Even if the block split failed, we have to properly write 1846 + * out all the changes we did so far. Otherwise we can end up 1847 + * with corrupted filesystem. 1848 + */ 1849 + ext4_mark_inode_dirty(handle, dir); 1850 + dx_release(frames); 1843 1851 return retval; 1844 1852 } 1845 1853
+1 -1
fs/ext4/resize.c
··· 1081 1081 break; 1082 1082 1083 1083 if (meta_bg == 0) 1084 - backup_block = group * bpg + blk_off; 1084 + backup_block = ((ext4_fsblk_t)group) * bpg + blk_off; 1085 1085 else 1086 1086 backup_block = (ext4_group_first_block_no(sb, group) + 1087 1087 ext4_bg_has_super(sb, group));
+15 -2
fs/ext4/super.c
··· 3526 3526 #ifdef CONFIG_EXT4_FS_POSIX_ACL 3527 3527 set_opt(sb, POSIX_ACL); 3528 3528 #endif 3529 + /* don't forget to enable journal_csum when metadata_csum is enabled. */ 3530 + if (ext4_has_metadata_csum(sb)) 3531 + set_opt(sb, JOURNAL_CHECKSUM); 3532 + 3529 3533 if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) 3530 3534 set_opt(sb, JOURNAL_DATA); 3531 3535 else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED) ··· 3947 3943 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) && 3948 3944 !(sb->s_flags & MS_RDONLY)) 3949 3945 if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) 3950 - goto failed_mount3; 3946 + goto failed_mount3a; 3951 3947 3952 3948 /* 3953 3949 * The first inode we look at is the journal inode. Don't try ··· 3956 3952 if (!test_opt(sb, NOLOAD) && 3957 3953 EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { 3958 3954 if (ext4_load_journal(sb, es, journal_devnum)) 3959 - goto failed_mount3; 3955 + goto failed_mount3a; 3960 3956 } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && 3961 3957 EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { 3962 3958 ext4_msg(sb, KERN_ERR, "required journal recovery " ··· 4244 4240 jbd2_journal_destroy(sbi->s_journal); 4245 4241 sbi->s_journal = NULL; 4246 4242 } 4243 + failed_mount3a: 4247 4244 ext4_es_unregister_shrinker(sbi); 4248 4245 failed_mount3: 4249 4246 del_timer_sync(&sbi->s_err_report); ··· 4842 4837 * Allow the "check" option to be passed as a remount option. 4843 4838 */ 4844 4839 if (!parse_options(data, sb, NULL, &journal_ioprio, 1)) { 4840 + err = -EINVAL; 4841 + goto restore_opts; 4842 + } 4843 + 4844 + if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^ 4845 + test_opt(sb, JOURNAL_CHECKSUM)) { 4846 + ext4_msg(sb, KERN_ERR, "changing journal_checksum " 4847 + "during remount not supported"); 4845 4848 err = -EINVAL; 4846 4849 goto restore_opts; 4847 4850 }
+2 -8
fs/jbd2/revoke.c
··· 92 92 #include <linux/init.h> 93 93 #include <linux/bio.h> 94 94 #include <linux/log2.h> 95 + #include <linux/hash.h> 95 96 #endif 96 97 97 98 static struct kmem_cache *jbd2_revoke_record_cache; ··· 131 130 132 131 /* Utility functions to maintain the revoke table */ 133 132 134 - /* Borrowed from buffer.c: this is a tried and tested block hash function */ 135 133 static inline int hash(journal_t *journal, unsigned long long block) 136 134 { 137 - struct jbd2_revoke_table_s *table = journal->j_revoke; 138 - int hash_shift = table->hash_shift; 139 - int hash = (int)block ^ (int)((block >> 31) >> 1); 140 - 141 - return ((hash << (hash_shift - 6)) ^ 142 - (hash >> 13) ^ 143 - (hash << (hash_shift - 12))) & (table->hash_size - 1); 135 + return hash_64(block, journal->j_revoke->hash_shift); 144 136 } 145 137 146 138 static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr,