Commit 65989db7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'ext4_for_linus-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 updates from Ted Ts'o:
 "New ext4 features:

   - Add support so tune2fs can modify/update the superblock using an
     ioctl, without needing write access to the block device

   - Add support for 32-bit reserved uid's and gid's

  Bug fixes:

   - Fix potential warnings and other failures caused by corrupted /
     fuzzed file systems

   - Fail unaligned direct I/O write with EINVAL instead of silently
     falling back to buffered I/O

   - Correectly handle fsmap queries for metadata mappings

   - Avoid journal stalls caused by writeback throttling

   - Add some missing GFP_NOFAIL flags to avoid potential deadlocks
     under extremem memory pressure

  Cleanups:

   - Remove obsolete EXT3 Kconfigs"

* tag 'ext4_for_linus-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: fix checks for orphan inodes
  ext4: validate ea_ino and size in check_xattrs
  ext4: guard against EA inode refcount underflow in xattr update
  ext4: implemet new ioctls to set and get superblock parameters
  ext4: add support for 32-bit default reserved uid and gid values
  ext4: avoid potential buffer over-read in parse_apply_sb_mount_options()
  ext4: fix an off-by-one issue during moving extents
  ext4: increase i_disksize to offset + len in ext4_update_disksize_before_punch()
  ext4: verify orphan file size is not too big
  ext4: fail unaligned direct IO write with EINVAL
  ext4: correctly handle queries for metadata mappings
  ext4: increase IO priority of fastcommit
  ext4: remove obsolete EXT3 config options
  jbd2: increase IO priority of checkpoint
  ext4: fix potential null deref in ext4_mb_init()
  ext4: add ext4_sb_bread_nofail() helper function for ext4_free_branches()
  ext4: replace min/max nesting with clamp()
  fs: ext4: change GFP_KERNEL to GFP_NOFS to avoid deadlock
parents a4eb9356 acf943e9
Loading
Loading
Loading
Loading
+0 −27
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
# Ext3 configs are here for backward compatibility with old configs which may
# have EXT3_FS set but not EXT4_FS set and thus would result in non-bootable
# kernels after the removal of ext3 driver.
config EXT3_FS
	tristate "The Extended 3 (ext3) filesystem"
	select EXT4_FS
	help
	  This config option is here only for backward compatibility. ext3
	  filesystem is now handled by the ext4 driver.

config EXT3_FS_POSIX_ACL
	bool "Ext3 POSIX Access Control Lists"
	depends on EXT3_FS
	select EXT4_FS_POSIX_ACL
	select FS_POSIX_ACL
	help
	  This config option is here only for backward compatibility. ext3
	  filesystem is now handled by the ext4 driver.

config EXT3_FS_SECURITY
	bool "Ext3 Security Labels"
	depends on EXT3_FS
	select EXT4_FS_SECURITY
	help
	  This config option is here only for backward compatibility. ext3
	  filesystem is now handled by the ext4 driver.

config EXT4_FS
	tristate "The Extended 4 (ext4) filesystem"
	select BUFFER_HEAD
+27 −1
Original line number Diff line number Diff line
@@ -1450,7 +1450,9 @@ struct ext4_super_block {
	__le16  s_encoding;		/* Filename charset encoding */
	__le16  s_encoding_flags;	/* Filename charset encoding flags */
	__le32  s_orphan_file_inum;	/* Inode for tracking orphan inodes */
	__le32	s_reserved[94];		/* Padding to the end of the block */
	__le16	s_def_resuid_hi;
	__le16	s_def_resgid_hi;
	__le32	s_reserved[93];		/* Padding to the end of the block */
	__le32	s_checksum;		/* crc32c(superblock) */
};

@@ -1820,6 +1822,18 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
		 ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count));
}

static inline int ext4_get_resuid(struct ext4_super_block *es)
{
	return le16_to_cpu(es->s_def_resuid) |
		le16_to_cpu(es->s_def_resuid_hi) << 16;
}

static inline int ext4_get_resgid(struct ext4_super_block *es)
{
	return le16_to_cpu(es->s_def_resgid) |
		le16_to_cpu(es->s_def_resgid_hi) << 16;
}

/*
 * Returns: sbi->field[index]
 * Used to access an array element from the following sbi fields which require
@@ -1989,6 +2003,16 @@ static inline bool ext4_verity_in_progress(struct inode *inode)

#define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime

/*
 * Check whether the inode is tracked as orphan (either in orphan file or
 * orphan list).
 */
static inline bool ext4_inode_orphan_tracked(struct inode *inode)
{
	return ext4_test_inode_state(inode, EXT4_STATE_ORPHAN_FILE) ||
		!list_empty(&EXT4_I(inode)->i_orphan);
}

/*
 * Codes for operating systems
 */
@@ -3142,6 +3166,8 @@ extern struct buffer_head *ext4_sb_bread(struct super_block *sb,
					 sector_t block, blk_opf_t op_flags);
extern struct buffer_head *ext4_sb_bread_unmovable(struct super_block *sb,
						   sector_t block);
extern struct buffer_head *ext4_sb_bread_nofail(struct super_block *sb,
						sector_t block);
extern void ext4_read_bh_nowait(struct buffer_head *bh, blk_opf_t op_flags,
				bh_end_io_t *end_io, bool simu_fail);
extern int ext4_read_bh(struct buffer_head *bh, blk_opf_t op_flags,
+1 −1
Original line number Diff line number Diff line
@@ -663,7 +663,7 @@ void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t star

static void ext4_fc_submit_bh(struct super_block *sb, bool is_tail)
{
	blk_opf_t write_flags = REQ_SYNC;
	blk_opf_t write_flags = JBD2_JOURNAL_REQ_FLAGS;
	struct buffer_head *bh = EXT4_SB(sb)->s_fc_bh;

	/* Add REQ_FUA | REQ_PREFLUSH only its tail */
+1 −1
Original line number Diff line number Diff line
@@ -354,7 +354,7 @@ static void ext4_inode_extension_cleanup(struct inode *inode, bool need_trunc)
	 * to cleanup the orphan list in ext4_handle_inode_extension(). Do it
	 * now.
	 */
	if (!list_empty(&EXT4_I(inode)->i_orphan) && inode->i_nlink) {
	if (ext4_inode_orphan_tracked(inode) && inode->i_nlink) {
		handle_t *handle = ext4_journal_start(inode, EXT4_HT_INODE, 2);

		if (IS_ERR(handle)) {
+9 −5
Original line number Diff line number Diff line
@@ -74,7 +74,8 @@ static int ext4_getfsmap_dev_compare(const void *p1, const void *p2)
static bool ext4_getfsmap_rec_before_low_key(struct ext4_getfsmap_info *info,
					     struct ext4_fsmap *rec)
{
	return rec->fmr_physical < info->gfi_low.fmr_physical;
	return rec->fmr_physical + rec->fmr_length <=
	       info->gfi_low.fmr_physical;
}

/*
@@ -200,15 +201,18 @@ static int ext4_getfsmap_meta_helper(struct super_block *sb,
			  ext4_group_first_block_no(sb, agno));
	fs_end = fs_start + EXT4_C2B(sbi, len);

	/* Return relevant extents from the meta_list */
	/*
	 * Return relevant extents from the meta_list. We emit all extents that
	 * partially/fully overlap with the query range
	 */
	list_for_each_entry_safe(p, tmp, &info->gfi_meta_list, fmr_list) {
		if (p->fmr_physical < info->gfi_next_fsblk) {
		if (p->fmr_physical + p->fmr_length <= info->gfi_next_fsblk) {
			list_del(&p->fmr_list);
			kfree(p);
			continue;
		}
		if (p->fmr_physical <= fs_start ||
		    p->fmr_physical + p->fmr_length <= fs_end) {
		if (p->fmr_physical <= fs_end &&
		    p->fmr_physical + p->fmr_length > fs_start) {
			/* Emit the retained free extent record if present */
			if (info->gfi_lastfree.fmr_owner) {
				error = ext4_getfsmap_helper(sb, info,
Loading