Skip to content

Commit 074e461

Browse files
committed
Merge tag 'ext4_for_linus-6.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fixes from Ted Ts'o: - Fix fast commit checks for file systems with ea_inode enabled - Don't drop the i_version mount option on a remount - Fix FIEMAP reporting when there are holes in a bigalloc file system - Don't fail when mounting read-only when there are inodes in the orphan file - Fix hole length overflow for indirect mapped files on file systems with an 8k or 16k block file system * tag 'ext4_for_linus-6.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: jbd2: prevent softlockup in jbd2_log_do_checkpoint() ext4: fix incorrect function name in comment ext4: use kmalloc_array() for array space allocation ext4: fix hole length calculation overflow in non-extent inodes ext4: don't try to clear the orphan_present feature block device is r/o ext4: fix reserved gdt blocks handling in fsmap ext4: fix fsmap end of range reporting with bigalloc ext4: remove redundant __GFP_NOWARN ext4: fix unused variable warning in ext4_init_new_dir ext4: remove useless if check ext4: check fast symlink for ea_inode correctly ext4: preserve SB_I_VERSION on remount ext4: show the default enabled i_version option
2 parents c17b750 + 9d98cf4 commit 074e461

File tree

8 files changed

+37
-18
lines changed

8 files changed

+37
-18
lines changed

fs/ext4/fsmap.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,14 @@ static unsigned int ext4_getfsmap_find_sb(struct super_block *sb,
393393
/* Reserved GDT blocks */
394394
if (!ext4_has_feature_meta_bg(sb) || metagroup < first_meta_bg) {
395395
len = le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks);
396+
397+
/*
398+
* mkfs.ext4 can set s_reserved_gdt_blocks as 0 in some cases,
399+
* check for that.
400+
*/
401+
if (!len)
402+
return 0;
403+
396404
error = ext4_getfsmap_fill(meta_list, fsb, len,
397405
EXT4_FMR_OWN_RESV_GDT);
398406
if (error)
@@ -526,6 +534,7 @@ static int ext4_getfsmap_datadev(struct super_block *sb,
526534
ext4_group_t end_ag;
527535
ext4_grpblk_t first_cluster;
528536
ext4_grpblk_t last_cluster;
537+
struct ext4_fsmap irec;
529538
int error = 0;
530539

531540
bofs = le32_to_cpu(sbi->s_es->s_first_data_block);
@@ -609,10 +618,18 @@ static int ext4_getfsmap_datadev(struct super_block *sb,
609618
goto err;
610619
}
611620

612-
/* Report any gaps at the end of the bg */
621+
/*
622+
* The dummy record below will cause ext4_getfsmap_helper() to report
623+
* any allocated blocks at the end of the range.
624+
*/
625+
irec.fmr_device = 0;
626+
irec.fmr_physical = end_fsb + 1;
627+
irec.fmr_length = 0;
628+
irec.fmr_owner = EXT4_FMR_OWN_FREE;
629+
irec.fmr_flags = 0;
630+
613631
info->gfi_last = true;
614-
error = ext4_getfsmap_datadev_helper(sb, end_ag, last_cluster + 1,
615-
0, info);
632+
error = ext4_getfsmap_helper(sb, info, &irec);
616633
if (error)
617634
goto err;
618635

fs/ext4/indirect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
539539
int indirect_blks;
540540
int blocks_to_boundary = 0;
541541
int depth;
542-
int count = 0;
542+
u64 count = 0;
543543
ext4_fsblk_t first_block = 0;
544544

545545
trace_ext4_ind_map_blocks_enter(inode, map->m_lblk, map->m_len, flags);
@@ -588,7 +588,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
588588
count++;
589589
/* Fill in size of a hole we found */
590590
map->m_pblk = 0;
591-
map->m_len = min_t(unsigned int, map->m_len, count);
591+
map->m_len = umin(map->m_len, count);
592592
goto cleanup;
593593
}
594594

fs/ext4/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static inline int ext4_begin_ordered_truncate(struct inode *inode,
146146
*/
147147
int ext4_inode_is_fast_symlink(struct inode *inode)
148148
{
149-
if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) {
149+
if (!ext4_has_feature_ea_inode(inode->i_sb)) {
150150
int ea_blocks = EXT4_I(inode)->i_file_acl ?
151151
EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0;
152152

@@ -3155,7 +3155,7 @@ static int ext4_da_write_begin(const struct kiocb *iocb,
31553155
folio_unlock(folio);
31563156
folio_put(folio);
31573157
/*
3158-
* block_write_begin may have instantiated a few blocks
3158+
* ext4_block_write_begin may have instantiated a few blocks
31593159
* outside i_size. Trim these off again. Don't need
31603160
* i_size_read because we hold inode lock.
31613161
*/

fs/ext4/namei.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,7 +2965,6 @@ int ext4_init_new_dir(handle_t *handle, struct inode *dir,
29652965
struct inode *inode)
29662966
{
29672967
struct buffer_head *dir_block = NULL;
2968-
struct ext4_dir_entry_2 *de;
29692968
ext4_lblk_t block = 0;
29702969
int err;
29712970

@@ -2982,10 +2981,7 @@ int ext4_init_new_dir(handle_t *handle, struct inode *dir,
29822981
dir_block = ext4_append(handle, inode, &block);
29832982
if (IS_ERR(dir_block))
29842983
return PTR_ERR(dir_block);
2985-
de = (struct ext4_dir_entry_2 *)dir_block->b_data;
29862984
err = ext4_init_dirblock(handle, inode, dir_block, dir->i_ino, NULL, 0);
2987-
if (err)
2988-
goto out;
29892985
out:
29902986
brelse(dir_block);
29912987
return err;

fs/ext4/orphan.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,9 @@ int ext4_init_orphan_info(struct super_block *sb)
589589
}
590590
oi->of_blocks = inode->i_size >> sb->s_blocksize_bits;
591591
oi->of_csum_seed = EXT4_I(inode)->i_csum_seed;
592-
oi->of_binfo = kmalloc(oi->of_blocks*sizeof(struct ext4_orphan_block),
593-
GFP_KERNEL);
592+
oi->of_binfo = kmalloc_array(oi->of_blocks,
593+
sizeof(struct ext4_orphan_block),
594+
GFP_KERNEL);
594595
if (!oi->of_binfo) {
595596
ret = -ENOMEM;
596597
goto out_put;

fs/ext4/page-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ int ext4_bio_write_folio(struct ext4_io_submit *io, struct folio *folio,
547547
* first page of the bio. Otherwise it can deadlock.
548548
*/
549549
if (io->io_bio)
550-
gfp_flags = GFP_NOWAIT | __GFP_NOWARN;
550+
gfp_flags = GFP_NOWAIT;
551551
retry_encrypt:
552552
bounce_page = fscrypt_encrypt_pagecache_blocks(folio,
553553
enc_bytes, 0, gfp_flags);

fs/ext4/super.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ struct buffer_head *ext4_sb_bread_unmovable(struct super_block *sb,
268268
void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block)
269269
{
270270
struct buffer_head *bh = bdev_getblk(sb->s_bdev, block,
271-
sb->s_blocksize, GFP_NOWAIT | __GFP_NOWARN);
271+
sb->s_blocksize, GFP_NOWAIT);
272272

273273
if (likely(bh)) {
274274
if (trylock_buffer(bh))
@@ -1998,6 +1998,9 @@ int ext4_init_fs_context(struct fs_context *fc)
19981998
fc->fs_private = ctx;
19991999
fc->ops = &ext4_context_ops;
20002000

2001+
/* i_version is always enabled now */
2002+
fc->sb_flags |= SB_I_VERSION;
2003+
20012004
return 0;
20022005
}
20032006

@@ -2975,6 +2978,8 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
29752978
SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time);
29762979
if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME)
29772980
SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time);
2981+
if (nodefs && sb->s_flags & SB_I_VERSION)
2982+
SEQ_OPTS_PUTS("i_version");
29782983
if (nodefs || sbi->s_stripe)
29792984
SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe);
29802985
if (nodefs || EXT4_MOUNT_DATA_FLAGS &
@@ -5314,9 +5319,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
53145319
sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
53155320
(test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
53165321

5317-
/* i_version is always enabled now */
5318-
sb->s_flags |= SB_I_VERSION;
5319-
53205322
/* HSM events are allowed by default. */
53215323
sb->s_iflags |= SB_I_ALLOW_HSM;
53225324

@@ -5414,6 +5416,8 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
54145416
err = ext4_load_and_init_journal(sb, es, ctx);
54155417
if (err)
54165418
goto failed_mount3a;
5419+
if (bdev_read_only(sb->s_bdev))
5420+
needs_recovery = 0;
54175421
} else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) &&
54185422
ext4_has_feature_journal_needs_recovery(sb)) {
54195423
ext4_msg(sb, KERN_ERR, "required journal recovery "

fs/jbd2/checkpoint.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ int jbd2_log_do_checkpoint(journal_t *journal)
285285
retry:
286286
if (batch_count)
287287
__flush_batch(journal, &batch_count);
288+
cond_resched();
288289
spin_lock(&journal->j_list_lock);
289290
goto restart;
290291
}

0 commit comments

Comments
 (0)