Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ext4: Properly count journal credits for long symlinks

Commit df5e6223407e ("ext4: fix deadlock in ext4_symlink() in ENOSPC
conditions") recalculated the number of credits needed for a long
symlink, in the process of splitting it into two transactions. However,
the first credit calculation under-counted because if selinux is
enabled, credits are needed to create the selinux xattr as well.

Overrunning the reservation will result in an OOPS in
jbd2_journal_dirty_metadata() due to this assert:

J_ASSERT_JH(jh, handle->h_buffer_credits > 0);

Fix this by increasing the reservation size.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Eric Sandeen and committed by
Linus Torvalds
8c208719 d2db60df

+4 -2
+4 -2
fs/ext4/namei.c
··· 2253 2253 /* 2254 2254 * For non-fast symlinks, we just allocate inode and put it on 2255 2255 * orphan list in the first transaction => we need bitmap, 2256 - * group descriptor, sb, inode block, quota blocks. 2256 + * group descriptor, sb, inode block, quota blocks, and 2257 + * possibly selinux xattr blocks. 2257 2258 */ 2258 - credits = 4 + EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb); 2259 + credits = 4 + EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb) + 2260 + EXT4_XATTR_TRANS_BLOCKS; 2259 2261 } else { 2260 2262 /* 2261 2263 * Fast symlink. We have to add entry to directory