Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a8098a4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull ext4 fixes from Ted Ts'o:
 "Fix a number of ext4 bugs; the most serious of which is a bug in the
  lazytime mount optimization code where we could end up updating the
  timestamps to the wrong inode"

* tag 'for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: fix an ext3 collapse range regression in xfstests
  jbd2: fix r_count overflows leading to buffer overflow in journal recovery
  ext4: check for zero length extent explicitly
  ext4: fix NULL pointer dereference when journal restart fails
  ext4: remove unused function prototype from ext4.h
  ext4: don't save the error information if the block device is read-only
  ext4: fix lazytime optimization
parents c7309e88 b9576fc3
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -2889,7 +2889,6 @@ extern int ext4_map_blocks(handle_t *handle, struct inode *inode,
			   struct ext4_map_blocks *map, int flags);
			   struct ext4_map_blocks *map, int flags);
extern int ext4_ext_calc_metadata_amount(struct inode *inode,
extern int ext4_ext_calc_metadata_amount(struct inode *inode,
					 ext4_lblk_t lblocks);
					 ext4_lblk_t lblocks);
extern int ext4_extent_tree_init(handle_t *, struct inode *);
extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
						   int num,
						   int num,
						   struct ext4_ext_path *path);
						   struct ext4_ext_path *path);
+6 −0
Original line number Original line Diff line number Diff line
@@ -87,6 +87,12 @@ int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle)
		ext4_put_nojournal(handle);
		ext4_put_nojournal(handle);
		return 0;
		return 0;
	}
	}

	if (!handle->h_transaction) {
		err = jbd2_journal_stop(handle);
		return handle->h_err ? handle->h_err : err;
	}

	sb = handle->h_transaction->t_journal->j_private;
	sb = handle->h_transaction->t_journal->j_private;
	err = handle->h_err;
	err = handle->h_err;
	rc = jbd2_journal_stop(handle);
	rc = jbd2_journal_stop(handle);
+9 −1
Original line number Original line Diff line number Diff line
@@ -377,7 +377,7 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)
	ext4_lblk_t lblock = le32_to_cpu(ext->ee_block);
	ext4_lblk_t lblock = le32_to_cpu(ext->ee_block);
	ext4_lblk_t last = lblock + len - 1;
	ext4_lblk_t last = lblock + len - 1;


	if (lblock > last)
	if (len == 0 || lblock > last)
		return 0;
		return 0;
	return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
	return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
}
}
@@ -5396,6 +5396,14 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
	loff_t new_size, ioffset;
	loff_t new_size, ioffset;
	int ret;
	int ret;


	/*
	 * We need to test this early because xfstests assumes that a
	 * collapse range of (0, 1) will return EOPNOTSUPP if the file
	 * system does not support collapse range.
	 */
	if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
		return -EOPNOTSUPP;

	/* Collapse range works only on fs block size aligned offsets. */
	/* Collapse range works only on fs block size aligned offsets. */
	if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) ||
	if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) ||
	    len & (EXT4_CLUSTER_SIZE(sb) - 1))
	    len & (EXT4_CLUSTER_SIZE(sb) - 1))
+1 −1
Original line number Original line Diff line number Diff line
@@ -4345,7 +4345,7 @@ static void ext4_update_other_inodes_time(struct super_block *sb,
	int inode_size = EXT4_INODE_SIZE(sb);
	int inode_size = EXT4_INODE_SIZE(sb);


	oi.orig_ino = orig_ino;
	oi.orig_ino = orig_ino;
	ino = orig_ino & ~(inodes_per_block - 1);
	ino = (orig_ino & ~(inodes_per_block - 1)) + 1;
	for (i = 0; i < inodes_per_block; i++, ino++, buf += inode_size) {
	for (i = 0; i < inodes_per_block; i++, ino++, buf += inode_size) {
		if (ino == orig_ino)
		if (ino == orig_ino)
			continue;
			continue;
+2 −0
Original line number Original line Diff line number Diff line
@@ -294,6 +294,8 @@ static void __save_error_info(struct super_block *sb, const char *func,
	struct ext4_super_block *es = EXT4_SB(sb)->s_es;
	struct ext4_super_block *es = EXT4_SB(sb)->s_es;


	EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
	EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
	if (bdev_read_only(sb->s_bdev))
		return;
	es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
	es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
	es->s_last_error_time = cpu_to_le32(get_seconds());
	es->s_last_error_time = cpu_to_le32(get_seconds());
	strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));
	strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));
Loading