mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
Ext4 bug fixes and cleanups for 6.17-rc3, including most notably:
* 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. -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEK2m5VNv+CHkogTfJ8vlZVpUNgaMFAmijEhcACgkQ8vlZVpUN gaNAhAf/YfJZ/S+cm1hNBEBA2l874MH6NGVjc19JMp9nXhBkFKXw7xsvMEM4IN5v EogWLCkGxszbPjtDMJvvLTf0YU8sC4YsOaxZsx2PhYYNt7xCipEAvszQ0HsC1ItU eUkk0uhQM6VzeHgO30i+vHdvpt9YvfvrJBtXsa8fFLi6+ORMArc4dttV8RWfkkTR xFt5Y3MdBK9bmBG4AQGN4REL3YkTKbVoFq7zS0e8/5Gk4HO9ttduDPPWHGIrDRUh T3pv/ADenHytkiLOVOnTnxioSD2QaYy0eI0TOqNyprLOfE1e8w3VtPAviJMXxKe3 cwaXyvtcjCJQiboRPt4S9w1hPWvKvA== =PwYy -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
074e461d9e
@ -393,6 +393,14 @@ static unsigned int ext4_getfsmap_find_sb(struct super_block *sb,
|
|||||||
/* Reserved GDT blocks */
|
/* Reserved GDT blocks */
|
||||||
if (!ext4_has_feature_meta_bg(sb) || metagroup < first_meta_bg) {
|
if (!ext4_has_feature_meta_bg(sb) || metagroup < first_meta_bg) {
|
||||||
len = le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks);
|
len = le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* mkfs.ext4 can set s_reserved_gdt_blocks as 0 in some cases,
|
||||||
|
* check for that.
|
||||||
|
*/
|
||||||
|
if (!len)
|
||||||
|
return 0;
|
||||||
|
|
||||||
error = ext4_getfsmap_fill(meta_list, fsb, len,
|
error = ext4_getfsmap_fill(meta_list, fsb, len,
|
||||||
EXT4_FMR_OWN_RESV_GDT);
|
EXT4_FMR_OWN_RESV_GDT);
|
||||||
if (error)
|
if (error)
|
||||||
@ -526,6 +534,7 @@ static int ext4_getfsmap_datadev(struct super_block *sb,
|
|||||||
ext4_group_t end_ag;
|
ext4_group_t end_ag;
|
||||||
ext4_grpblk_t first_cluster;
|
ext4_grpblk_t first_cluster;
|
||||||
ext4_grpblk_t last_cluster;
|
ext4_grpblk_t last_cluster;
|
||||||
|
struct ext4_fsmap irec;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
bofs = le32_to_cpu(sbi->s_es->s_first_data_block);
|
bofs = le32_to_cpu(sbi->s_es->s_first_data_block);
|
||||||
@ -609,10 +618,18 @@ static int ext4_getfsmap_datadev(struct super_block *sb,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Report any gaps at the end of the bg */
|
/*
|
||||||
|
* The dummy record below will cause ext4_getfsmap_helper() to report
|
||||||
|
* any allocated blocks at the end of the range.
|
||||||
|
*/
|
||||||
|
irec.fmr_device = 0;
|
||||||
|
irec.fmr_physical = end_fsb + 1;
|
||||||
|
irec.fmr_length = 0;
|
||||||
|
irec.fmr_owner = EXT4_FMR_OWN_FREE;
|
||||||
|
irec.fmr_flags = 0;
|
||||||
|
|
||||||
info->gfi_last = true;
|
info->gfi_last = true;
|
||||||
error = ext4_getfsmap_datadev_helper(sb, end_ag, last_cluster + 1,
|
error = ext4_getfsmap_helper(sb, info, &irec);
|
||||||
0, info);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
|
|||||||
int indirect_blks;
|
int indirect_blks;
|
||||||
int blocks_to_boundary = 0;
|
int blocks_to_boundary = 0;
|
||||||
int depth;
|
int depth;
|
||||||
int count = 0;
|
u64 count = 0;
|
||||||
ext4_fsblk_t first_block = 0;
|
ext4_fsblk_t first_block = 0;
|
||||||
|
|
||||||
trace_ext4_ind_map_blocks_enter(inode, map->m_lblk, map->m_len, flags);
|
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,
|
|||||||
count++;
|
count++;
|
||||||
/* Fill in size of a hole we found */
|
/* Fill in size of a hole we found */
|
||||||
map->m_pblk = 0;
|
map->m_pblk = 0;
|
||||||
map->m_len = min_t(unsigned int, map->m_len, count);
|
map->m_len = umin(map->m_len, count);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ static inline int ext4_begin_ordered_truncate(struct inode *inode,
|
|||||||
*/
|
*/
|
||||||
int ext4_inode_is_fast_symlink(struct inode *inode)
|
int ext4_inode_is_fast_symlink(struct inode *inode)
|
||||||
{
|
{
|
||||||
if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) {
|
if (!ext4_has_feature_ea_inode(inode->i_sb)) {
|
||||||
int ea_blocks = EXT4_I(inode)->i_file_acl ?
|
int ea_blocks = EXT4_I(inode)->i_file_acl ?
|
||||||
EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0;
|
EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0;
|
||||||
|
|
||||||
@ -3155,7 +3155,7 @@ retry:
|
|||||||
folio_unlock(folio);
|
folio_unlock(folio);
|
||||||
folio_put(folio);
|
folio_put(folio);
|
||||||
/*
|
/*
|
||||||
* block_write_begin may have instantiated a few blocks
|
* ext4_block_write_begin may have instantiated a few blocks
|
||||||
* outside i_size. Trim these off again. Don't need
|
* outside i_size. Trim these off again. Don't need
|
||||||
* i_size_read because we hold inode lock.
|
* i_size_read because we hold inode lock.
|
||||||
*/
|
*/
|
||||||
|
@ -2965,7 +2965,6 @@ int ext4_init_new_dir(handle_t *handle, struct inode *dir,
|
|||||||
struct inode *inode)
|
struct inode *inode)
|
||||||
{
|
{
|
||||||
struct buffer_head *dir_block = NULL;
|
struct buffer_head *dir_block = NULL;
|
||||||
struct ext4_dir_entry_2 *de;
|
|
||||||
ext4_lblk_t block = 0;
|
ext4_lblk_t block = 0;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@ -2982,10 +2981,7 @@ int ext4_init_new_dir(handle_t *handle, struct inode *dir,
|
|||||||
dir_block = ext4_append(handle, inode, &block);
|
dir_block = ext4_append(handle, inode, &block);
|
||||||
if (IS_ERR(dir_block))
|
if (IS_ERR(dir_block))
|
||||||
return PTR_ERR(dir_block);
|
return PTR_ERR(dir_block);
|
||||||
de = (struct ext4_dir_entry_2 *)dir_block->b_data;
|
|
||||||
err = ext4_init_dirblock(handle, inode, dir_block, dir->i_ino, NULL, 0);
|
err = ext4_init_dirblock(handle, inode, dir_block, dir->i_ino, NULL, 0);
|
||||||
if (err)
|
|
||||||
goto out;
|
|
||||||
out:
|
out:
|
||||||
brelse(dir_block);
|
brelse(dir_block);
|
||||||
return err;
|
return err;
|
||||||
|
@ -589,8 +589,9 @@ int ext4_init_orphan_info(struct super_block *sb)
|
|||||||
}
|
}
|
||||||
oi->of_blocks = inode->i_size >> sb->s_blocksize_bits;
|
oi->of_blocks = inode->i_size >> sb->s_blocksize_bits;
|
||||||
oi->of_csum_seed = EXT4_I(inode)->i_csum_seed;
|
oi->of_csum_seed = EXT4_I(inode)->i_csum_seed;
|
||||||
oi->of_binfo = kmalloc(oi->of_blocks*sizeof(struct ext4_orphan_block),
|
oi->of_binfo = kmalloc_array(oi->of_blocks,
|
||||||
GFP_KERNEL);
|
sizeof(struct ext4_orphan_block),
|
||||||
|
GFP_KERNEL);
|
||||||
if (!oi->of_binfo) {
|
if (!oi->of_binfo) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out_put;
|
goto out_put;
|
||||||
|
@ -547,7 +547,7 @@ int ext4_bio_write_folio(struct ext4_io_submit *io, struct folio *folio,
|
|||||||
* first page of the bio. Otherwise it can deadlock.
|
* first page of the bio. Otherwise it can deadlock.
|
||||||
*/
|
*/
|
||||||
if (io->io_bio)
|
if (io->io_bio)
|
||||||
gfp_flags = GFP_NOWAIT | __GFP_NOWARN;
|
gfp_flags = GFP_NOWAIT;
|
||||||
retry_encrypt:
|
retry_encrypt:
|
||||||
bounce_page = fscrypt_encrypt_pagecache_blocks(folio,
|
bounce_page = fscrypt_encrypt_pagecache_blocks(folio,
|
||||||
enc_bytes, 0, gfp_flags);
|
enc_bytes, 0, gfp_flags);
|
||||||
|
@ -268,7 +268,7 @@ struct buffer_head *ext4_sb_bread_unmovable(struct super_block *sb,
|
|||||||
void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block)
|
void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block)
|
||||||
{
|
{
|
||||||
struct buffer_head *bh = bdev_getblk(sb->s_bdev, block,
|
struct buffer_head *bh = bdev_getblk(sb->s_bdev, block,
|
||||||
sb->s_blocksize, GFP_NOWAIT | __GFP_NOWARN);
|
sb->s_blocksize, GFP_NOWAIT);
|
||||||
|
|
||||||
if (likely(bh)) {
|
if (likely(bh)) {
|
||||||
if (trylock_buffer(bh))
|
if (trylock_buffer(bh))
|
||||||
@ -1998,6 +1998,9 @@ int ext4_init_fs_context(struct fs_context *fc)
|
|||||||
fc->fs_private = ctx;
|
fc->fs_private = ctx;
|
||||||
fc->ops = &ext4_context_ops;
|
fc->ops = &ext4_context_ops;
|
||||||
|
|
||||||
|
/* i_version is always enabled now */
|
||||||
|
fc->sb_flags |= SB_I_VERSION;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2975,6 +2978,8 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
|
|||||||
SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time);
|
SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time);
|
||||||
if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME)
|
if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME)
|
||||||
SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time);
|
SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time);
|
||||||
|
if (nodefs && sb->s_flags & SB_I_VERSION)
|
||||||
|
SEQ_OPTS_PUTS("i_version");
|
||||||
if (nodefs || sbi->s_stripe)
|
if (nodefs || sbi->s_stripe)
|
||||||
SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe);
|
SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe);
|
||||||
if (nodefs || EXT4_MOUNT_DATA_FLAGS &
|
if (nodefs || EXT4_MOUNT_DATA_FLAGS &
|
||||||
@ -5314,9 +5319,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
|
|||||||
sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
|
sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
|
||||||
(test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
|
(test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
|
||||||
|
|
||||||
/* i_version is always enabled now */
|
|
||||||
sb->s_flags |= SB_I_VERSION;
|
|
||||||
|
|
||||||
/* HSM events are allowed by default. */
|
/* HSM events are allowed by default. */
|
||||||
sb->s_iflags |= SB_I_ALLOW_HSM;
|
sb->s_iflags |= SB_I_ALLOW_HSM;
|
||||||
|
|
||||||
@ -5414,6 +5416,8 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
|
|||||||
err = ext4_load_and_init_journal(sb, es, ctx);
|
err = ext4_load_and_init_journal(sb, es, ctx);
|
||||||
if (err)
|
if (err)
|
||||||
goto failed_mount3a;
|
goto failed_mount3a;
|
||||||
|
if (bdev_read_only(sb->s_bdev))
|
||||||
|
needs_recovery = 0;
|
||||||
} else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) &&
|
} else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) &&
|
||||||
ext4_has_feature_journal_needs_recovery(sb)) {
|
ext4_has_feature_journal_needs_recovery(sb)) {
|
||||||
ext4_msg(sb, KERN_ERR, "required journal recovery "
|
ext4_msg(sb, KERN_ERR, "required journal recovery "
|
||||||
|
@ -285,6 +285,7 @@ restart:
|
|||||||
retry:
|
retry:
|
||||||
if (batch_count)
|
if (batch_count)
|
||||||
__flush_batch(journal, &batch_count);
|
__flush_batch(journal, &batch_count);
|
||||||
|
cond_resched();
|
||||||
spin_lock(&journal->j_list_lock);
|
spin_lock(&journal->j_list_lock);
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user