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:
"Some ext4 regression and bug fixes"

* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: clean up error handling in __ext4_fill_super()
ext4: reflect error codes from ext4_multi_mount_protect() to its callers
ext4: fix lost error code reporting in __ext4_fill_super()
ext4: fix unused iterator variable warnings
ext4: fix use-after-free read in ext4_find_extent for bigalloc + inline
ext4: fix i_disksize exceeding i_size problem in paritally written case

+56 -36
+2 -1
fs/ext4/extents.c
··· 5795 5795 * mapped - no physical clusters have been allocated, and the 5796 5796 * file has no extents 5797 5797 */ 5798 - if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) 5798 + if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA) || 5799 + ext4_has_inline_data(inode)) 5799 5800 return 0; 5800 5801 5801 5802 /* search for the extent closest to the first block in the cluster */
+3
fs/ext4/inode.c
··· 2982 2982 ext4_has_inline_data(inode)) 2983 2983 return ext4_write_inline_data_end(inode, pos, len, copied, page); 2984 2984 2985 + if (unlikely(copied < len) && !PageUptodate(page)) 2986 + copied = 0; 2987 + 2985 2988 start = pos & (PAGE_SIZE - 1); 2986 2989 end = start + copied - 1; 2987 2990
+8 -1
fs/ext4/mmp.c
··· 282 282 if (mmp_block < le32_to_cpu(es->s_first_data_block) || 283 283 mmp_block >= ext4_blocks_count(es)) { 284 284 ext4_warning(sb, "Invalid MMP block in superblock"); 285 + retval = -EINVAL; 285 286 goto failed; 286 287 } 287 288 ··· 308 307 309 308 if (seq == EXT4_MMP_SEQ_FSCK) { 310 309 dump_mmp_msg(sb, mmp, "fsck is running on the filesystem"); 310 + retval = -EBUSY; 311 311 goto failed; 312 312 } 313 313 ··· 322 320 323 321 if (schedule_timeout_interruptible(HZ * wait_time) != 0) { 324 322 ext4_warning(sb, "MMP startup interrupted, failing mount\n"); 323 + retval = -ETIMEDOUT; 325 324 goto failed; 326 325 } 327 326 ··· 333 330 if (seq != le32_to_cpu(mmp->mmp_seq)) { 334 331 dump_mmp_msg(sb, mmp, 335 332 "Device is already active on another node."); 333 + retval = -EBUSY; 336 334 goto failed; 337 335 } 338 336 ··· 353 349 */ 354 350 if (schedule_timeout_interruptible(HZ * wait_time) != 0) { 355 351 ext4_warning(sb, "MMP startup interrupted, failing mount"); 352 + retval = -ETIMEDOUT; 356 353 goto failed; 357 354 } 358 355 ··· 364 359 if (seq != le32_to_cpu(mmp->mmp_seq)) { 365 360 dump_mmp_msg(sb, mmp, 366 361 "Device is already active on another node."); 362 + retval = -EBUSY; 367 363 goto failed; 368 364 } 369 365 ··· 384 378 EXT4_SB(sb)->s_mmp_tsk = NULL; 385 379 ext4_warning(sb, "Unable to create kmmpd thread for %s.", 386 380 sb->s_id); 381 + retval = -ENOMEM; 387 382 goto failed; 388 383 } 389 384 ··· 392 385 393 386 failed: 394 387 brelse(bh); 395 - return 1; 388 + return retval; 396 389 }
+43 -34
fs/ext4/super.c
··· 1259 1259 struct ext4_sb_info *sbi = EXT4_SB(sb); 1260 1260 struct ext4_super_block *es = sbi->s_es; 1261 1261 int aborted = 0; 1262 - int i, err; 1262 + int err; 1263 1263 1264 1264 /* 1265 1265 * Unregister sysfs before destroying jbd2 journal. ··· 1311 1311 ext4_flex_groups_free(sbi); 1312 1312 ext4_percpu_param_destroy(sbi); 1313 1313 #ifdef CONFIG_QUOTA 1314 - for (i = 0; i < EXT4_MAXQUOTAS; i++) 1314 + for (int i = 0; i < EXT4_MAXQUOTAS; i++) 1315 1315 kfree(get_qf_name(sb, sbi, i)); 1316 1316 #endif 1317 1317 ··· 5196 5196 struct ext4_sb_info *sbi = EXT4_SB(sb); 5197 5197 ext4_fsblk_t logical_sb_block; 5198 5198 struct inode *root; 5199 - int ret = -ENOMEM; 5200 - unsigned int i; 5201 5199 int needs_recovery; 5202 - int err = 0; 5200 + int err; 5203 5201 ext4_group_t first_not_zeroed; 5204 5202 struct ext4_fs_context *ctx = fc->fs_private; 5205 5203 int silent = fc->sb_flags & SB_SILENT; ··· 5210 5212 sbi->s_sectors_written_start = 5211 5213 part_stat_read(sb->s_bdev, sectors[STAT_WRITE]); 5212 5214 5213 - /* -EINVAL is default */ 5214 - ret = -EINVAL; 5215 5215 err = ext4_load_super(sb, &logical_sb_block, silent); 5216 5216 if (err) 5217 5217 goto out_fail; ··· 5235 5239 */ 5236 5240 sbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT; 5237 5241 5238 - if (ext4_inode_info_init(sb, es)) 5242 + err = ext4_inode_info_init(sb, es); 5243 + if (err) 5239 5244 goto failed_mount; 5240 5245 5241 5246 err = parse_apply_sb_mount_options(sb, ctx); ··· 5252 5255 5253 5256 ext4_apply_options(fc, sb); 5254 5257 5255 - if (ext4_encoding_init(sb, es)) 5258 + err = ext4_encoding_init(sb, es); 5259 + if (err) 5256 5260 goto failed_mount; 5257 5261 5258 - if (ext4_check_journal_data_mode(sb)) 5262 + err = ext4_check_journal_data_mode(sb); 5263 + if (err) 5259 5264 goto failed_mount; 5260 5265 5261 5266 sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | ··· 5266 5267 /* i_version is always enabled now */ 5267 5268 sb->s_flags |= SB_I_VERSION; 5268 5269 5269 - if (ext4_check_feature_compatibility(sb, es, silent)) 5270 + err = ext4_check_feature_compatibility(sb, es, silent); 5271 + if (err) 5270 5272 goto failed_mount; 5271 5273 5272 - if (ext4_block_group_meta_init(sb, silent)) 5274 + err = ext4_block_group_meta_init(sb, silent); 5275 + if (err) 5273 5276 goto failed_mount; 5274 5277 5275 5278 ext4_hash_info_init(sb); 5276 5279 5277 - if (ext4_handle_clustersize(sb)) 5280 + err = ext4_handle_clustersize(sb); 5281 + if (err) 5278 5282 goto failed_mount; 5279 5283 5280 - if (ext4_check_geometry(sb, es)) 5284 + err = ext4_check_geometry(sb, es); 5285 + if (err) 5281 5286 goto failed_mount; 5282 5287 5283 5288 timer_setup(&sbi->s_err_report, print_daily_error_info, 0); ··· 5292 5289 if (err) 5293 5290 goto failed_mount3; 5294 5291 5295 - /* Register extent status tree shrinker */ 5296 - if (ext4_es_register_shrinker(sbi)) 5292 + err = ext4_es_register_shrinker(sbi); 5293 + if (err) 5297 5294 goto failed_mount3; 5298 5295 5299 5296 sbi->s_stripe = ext4_get_stripe_size(sbi); ··· 5332 5329 ext4_has_feature_orphan_present(sb) || 5333 5330 ext4_has_feature_journal_needs_recovery(sb)); 5334 5331 5335 - if (ext4_has_feature_mmp(sb) && !sb_rdonly(sb)) 5336 - if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) 5332 + if (ext4_has_feature_mmp(sb) && !sb_rdonly(sb)) { 5333 + err = ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)); 5334 + if (err) 5337 5335 goto failed_mount3a; 5336 + } 5338 5337 5338 + err = -EINVAL; 5339 5339 /* 5340 5340 * The first inode we look at is the journal inode. Don't try 5341 5341 * root first: it may be modified in the journal! ··· 5390 5384 if (!sbi->s_ea_block_cache) { 5391 5385 ext4_msg(sb, KERN_ERR, 5392 5386 "Failed to create ea_block_cache"); 5387 + err = -EINVAL; 5393 5388 goto failed_mount_wq; 5394 5389 } 5395 5390 ··· 5399 5392 if (!sbi->s_ea_inode_cache) { 5400 5393 ext4_msg(sb, KERN_ERR, 5401 5394 "Failed to create ea_inode_cache"); 5395 + err = -EINVAL; 5402 5396 goto failed_mount_wq; 5403 5397 } 5404 5398 } ··· 5434 5426 alloc_workqueue("ext4-rsv-conversion", WQ_MEM_RECLAIM | WQ_UNBOUND, 1); 5435 5427 if (!EXT4_SB(sb)->rsv_conversion_wq) { 5436 5428 printk(KERN_ERR "EXT4-fs: failed to create workqueue\n"); 5437 - ret = -ENOMEM; 5429 + err = -ENOMEM; 5438 5430 goto failed_mount4; 5439 5431 } 5440 5432 ··· 5446 5438 root = ext4_iget(sb, EXT4_ROOT_INO, EXT4_IGET_SPECIAL); 5447 5439 if (IS_ERR(root)) { 5448 5440 ext4_msg(sb, KERN_ERR, "get root inode failed"); 5449 - ret = PTR_ERR(root); 5441 + err = PTR_ERR(root); 5450 5442 root = NULL; 5451 5443 goto failed_mount4; 5452 5444 } 5453 5445 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 5454 5446 ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck"); 5455 5447 iput(root); 5448 + err = -EFSCORRUPTED; 5456 5449 goto failed_mount4; 5457 5450 } 5458 5451 5459 5452 sb->s_root = d_make_root(root); 5460 5453 if (!sb->s_root) { 5461 5454 ext4_msg(sb, KERN_ERR, "get root dentry failed"); 5462 - ret = -ENOMEM; 5455 + err = -ENOMEM; 5463 5456 goto failed_mount4; 5464 5457 } 5465 5458 5466 - ret = ext4_setup_super(sb, es, sb_rdonly(sb)); 5467 - if (ret == -EROFS) { 5459 + err = ext4_setup_super(sb, es, sb_rdonly(sb)); 5460 + if (err == -EROFS) { 5468 5461 sb->s_flags |= SB_RDONLY; 5469 - ret = 0; 5470 - } else if (ret) 5462 + } else if (err) 5471 5463 goto failed_mount4a; 5472 5464 5473 5465 ext4_set_resv_clusters(sb); ··· 5511 5503 sbi->s_journal->j_commit_callback = 5512 5504 ext4_journal_commit_callback; 5513 5505 5514 - if (ext4_percpu_param_init(sbi)) 5506 + err = ext4_percpu_param_init(sbi); 5507 + if (err) 5515 5508 goto failed_mount6; 5516 5509 5517 5510 if (ext4_has_feature_flex_bg(sb)) ··· 5520 5511 ext4_msg(sb, KERN_ERR, 5521 5512 "unable to initialize " 5522 5513 "flex_bg meta info!"); 5523 - ret = -ENOMEM; 5514 + err = -ENOMEM; 5524 5515 goto failed_mount6; 5525 5516 } 5526 5517 ··· 5637 5628 #endif 5638 5629 5639 5630 #ifdef CONFIG_QUOTA 5640 - for (i = 0; i < EXT4_MAXQUOTAS; i++) 5631 + for (unsigned int i = 0; i < EXT4_MAXQUOTAS; i++) 5641 5632 kfree(get_qf_name(sb, sbi, i)); 5642 5633 #endif 5643 5634 fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy); ··· 5646 5637 ext4_blkdev_remove(sbi); 5647 5638 out_fail: 5648 5639 sb->s_fs_info = NULL; 5649 - return err ? err : ret; 5640 + return err; 5650 5641 } 5651 5642 5652 5643 static int ext4_fill_super(struct super_block *sb, struct fs_context *fc) ··· 6574 6565 goto restore_opts; 6575 6566 6576 6567 sb->s_flags &= ~SB_RDONLY; 6577 - if (ext4_has_feature_mmp(sb)) 6578 - if (ext4_multi_mount_protect(sb, 6579 - le64_to_cpu(es->s_mmp_block))) { 6580 - err = -EROFS; 6568 + if (ext4_has_feature_mmp(sb)) { 6569 + err = ext4_multi_mount_protect(sb, 6570 + le64_to_cpu(es->s_mmp_block)); 6571 + if (err) 6581 6572 goto restore_opts; 6582 - } 6573 + } 6583 6574 #ifdef CONFIG_QUOTA 6584 6575 enable_quota = 1; 6585 6576 #endif