Skip to content

Commit 1c6b942

Browse files
committed
Merge tag 'ext4_for_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fixes from Ted Ts'o: "Fix a regression which caused us to fail to interpret symlinks in very ancient ext3 file system images. Also fix two xfstests failures, one of which could cause an OOPS, plus an additional bug fix caught by fuzz testing" * tag 'ext4_for_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: fix crash when a directory's i_size is too small ext4: add missing error check in __ext4_new_inode() ext4: fix fdatasync(2) after fallocate(2) operation ext4: support fast symlinks from ext3 file systems
2 parents f3b5ad8 + 9d5afec commit 1c6b942

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

fs/ext4/extents.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4722,6 +4722,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset,
47224722
EXT4_INODE_EOFBLOCKS);
47234723
}
47244724
ext4_mark_inode_dirty(handle, inode);
4725+
ext4_update_inode_fsync_trans(handle, inode, 1);
47254726
ret2 = ext4_journal_stop(handle);
47264727
if (ret2)
47274728
break;

fs/ext4/ialloc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,8 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
816816
#ifdef CONFIG_EXT4_FS_POSIX_ACL
817817
struct posix_acl *p = get_acl(dir, ACL_TYPE_DEFAULT);
818818

819+
if (IS_ERR(p))
820+
return ERR_CAST(p);
819821
if (p) {
820822
int acl_size = p->a_count * sizeof(ext4_acl_entry);
821823

fs/ext4/inode.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ static int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
149149
*/
150150
int ext4_inode_is_fast_symlink(struct inode *inode)
151151
{
152+
if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) {
153+
int ea_blocks = EXT4_I(inode)->i_file_acl ?
154+
EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0;
155+
156+
if (ext4_has_inline_data(inode))
157+
return 0;
158+
159+
return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0);
160+
}
152161
return S_ISLNK(inode->i_mode) && inode->i_size &&
153162
(inode->i_size < EXT4_N_BLOCKS * 4);
154163
}

fs/ext4/namei.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,10 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
13991399
"falling back\n"));
14001400
}
14011401
nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb);
1402+
if (!nblocks) {
1403+
ret = NULL;
1404+
goto cleanup_and_exit;
1405+
}
14021406
start = EXT4_I(dir)->i_dir_start_lookup;
14031407
if (start >= nblocks)
14041408
start = 0;

0 commit comments

Comments
 (0)